When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

upen_g's blog

By upen_g, 11 years ago, In English

Hello everyone.. I want to know about hacking a solution. I am here for learn something that's why i want to know about hacking of a solution.Please anyone tell me in briefly about generating testcase and about hacking of another's solution.

Thanks in advance.

  • Vote: I like it
  • +10
  • Vote: I do not like it

| Write comment?
»
11 years ago, # |
  Vote: I like it -20 Vote: I do not like it

 Just Hack It!

»
11 years ago, # |
  Vote: I like it +2 Vote: I do not like it

after you pass the pretest , return to the dashbord and lock your code. then go to the rooms and double click to the solution of your roommates, then you can see the code and then if you want, hack it.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    And when you lock your problem you cant submit on that problem again.So be sure your problem is ablsolutely right before you lock it.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hi, please what do you mean by the rooms? Is it the standings?

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Codeforces randomly group contestants in groups of 30 and assign a room number to the group. You can only hack solutions of contestants in the same room.

»
11 years ago, # |
  Vote: I like it +18 Vote: I do not like it

On the dashboard, click the padlock icon for locking a problem (Note, that you can not send your solution for a problem after locking it). Then go to room results, where you can see roommates codes for the problems you've already locked (you can see a certain solution by double clicking on it in the room results table). After you've opened someone's solution, you can consider it and then hack it. When hacking a code, you're entering some testcase on which that code is most likely going to fail (it may be wrong answer, or running out of time/memory limit). When you want to enter a large testcase, you can send test generator instead of typing it. Test generator must be your program which produces a file with a testcase in it. After hacking a code, you can see hacking results. There are two possible outcomes: "Successful hack" — it means the code failed, and you're rewarded with 100 points for that. Otherwise, it's "Unsuccessful hack" (the code did not fail) and you get minus 50 points for that.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, I've a question :) Suppose, I've solved a problem and locked it. Then I've hacked 1 (or more) submission(s). Now, what will happen if my solution for that problem get hacked too? Will my points (for successful hacking attempts) be removed? And can I keep hacking even after my solution is hacked?

    Thanks..

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What do you mean by this line- "you can't send your problem after locking it". Does it mean that my locked solution will not be counted as a submission for my ranking? And another question: If I am unable to solve a question, then can I submit a wrong solution to it, so that I can lock and then hack others' correct solution? (if locking does not count in ranking!)

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      you can't send your problem after locking it It means you cannot resubmit another solution to that question if you realize that your 1st submission was incorrect. can I submit a wrong solution to it No, you can only lock your submission if it passes the pretests.

»
11 years ago, # |
  Vote: I like it +7 Vote: I do not like it

If you cant solve more problems it is a good way to get points

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Yeah, but you have to be careful cause you can lose points and get bad result...So, don't play with it=)

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Solution for how to hack: WikiHow

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In Educational Div2 and Div3 rounds, you can see anyone's code after the contest and hack it within 12hrs after the contest ends. For hacking in those rounds, you have to open someone's solution and in the top of it there will be options to copy, hack, etc. Click on hack option. And then send the inputs in which the code is not giving the correct output. If your claim is correct, then successful hack otherwise not. But in case of Div2. rounds, there are some restrictions. You can hack the solution in your room only and that too during the contest only. You have to lock your solution first (if and only if pretests passed). For locking a solution you have to go to the Dashboard and there will be a lock symbol after the question name. Click on it and then confirm locking. After then go to your room and then you can see the solution of any of the participants in your room and you can hack it. But in case of unsuccessful hack you will lose 50 points. So be careful and confident while doing so!!

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I had a question about hacking, my solution in Codeforces Round #653 got hacked. I saw his input but the output of mine was same as the top codes on leaderboard. What does that mean?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your solution got hacked because you got timelimit. Your answers were right, but square root solutions will fail anyways. Lets say number is $$$10^8$$$(it can be up to $$$10^9$$$. But square root of $$$10^8$$$ is easier to get). Its square root is $$$10^4$$$. The amount of testcases are $$$2*10^4$$$. That will timelimit for sure(For average cases, 0.6 second(may vary depending on operations factor. Example: sets/maps have high constant factor which are slower than expected in large inputs.) execution time in C++ for each $$$10^8$$$ operations. This is without taking input and without outputting).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What happens if a testcase from a hacker does not meet the constraints? (e.g. the first line of input is a variable N, and the problem states N is between 1 and 10000, and the hacker puts N = 3000000). Does the hack get counted as unsuccessful?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Do people seriously not know how to google.

    A google search of "codeforces rules" gives https://codeforces.com/blog/entry/4088. We can then control/command + f to search for "hack". This brings us to the hacks section. Reading the bullet points carefully, we find in point 2
    The system automatically validates the test to satisfy problem statement constraints. If it doesn't, the contestant is notified about it and the hack attempt is ignored.