CodingKnight's blog

By CodingKnight, 2 years ago, In English

Hello Codeforces,

I have just been practicing during final hour of the open-hacking phase of yesterday's Div. 4 round, when I noticed that someone has just successfully hacked his/her own solution submitted during the contest!

Is there any reasonable explanation for doing that?

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

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

Why not you tell me that first

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

    I am just curious to know if there is any plausible motivation.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -8 Vote: I do not like it

      let say if there is a algorithm that runs in O(log4/3(n)*e^nlog3.53(n^5/3.4)/log4(log(log(n*n-3)+n^(4+n))) and then you eventually find it. So all you now want to do is hack yourself. Good day to you.

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

        Thanks for the kind correpondence. I am not sure about the benefit of hacking my own solution. Suppose that I find an algorithm with lower complexity, why don't I just make new submission instead of using the hack option? Is there any benefit to invalidating my own solution during the open-hacking phase? Let me ask you the question in other words. Suppose that the solution is not hacked, and that it failed to pass the system test. Which situation is better for me? Isn't there any chance that the solution with the higher complexity which passed the pretest would have passed the system test?

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

          It's probably to add your test to system tests.

          Very simple example.

          Question : Given 3 numbers less than $$$10^9$$$, output their sum.

          Your Code

          int a,b,c;
          cin>>a>>b>>c;
          cout<<a+b+c<<"\n";
          

          This code is wrong because of overflow. But many participants may make this mistake. So if they get WA on system tests, your rank will be better. So if you want to add a testcase where the numbers will overflow, you can submit this, and then hack it. Obviously the pretests won't be that bad, but that's the general idea.

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

            Ok. But then, the contestant would have lost his/her own submission by self-hacking. How would that improve the contestant rank?

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it -9 Vote: I do not like it

              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. For an expert a few points here and there won't matter besides they just gained the experience of how hacking works on this site.

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

              I think the reward from the hack can sometimes be better than the points of the problem .

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

Well, it depends, but I'm inclined to say that the user found a counterexample for the submission, and hacked himself

»
2 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
  • In Educational/Div. 3/Div. 4 rounds, hacks does not increase the point value. Hacking your own solution will never increase your rank. So it's only for educational purposes.
  • Note that for rated users, this will only decrease their rating change. However if you get some rating points you don't deserve from weak test cases, for moral reasons it makes sense for some people to want to correct the situation.

In this particular contest: I used a small script to filter only the successful self-challenges

[...jQuery("#pageContent tbody")[0].children].slice(1).forEach(x=> x.style.display=(   jQuery(x.children[2]).find(".rated-user").text()!=jQuery(x.children[3]).find(".rated-user").text()||jQuery(x.children[6]).find(".verdict-challenged").length==0) ? "none": "")

There are 9 challenges done during the open hacking phase (19:35 to 7:35, UTC+3. Because of a Codeforces bug/unimplemented feature, time on /hacks page is always displayed in UTC+3):

  • 5 of them comes from unrated participants (so they're only for educational purposes)
  • 2 of the rest are hacks that target the intentional mistakes in the code (1 2) (note that those hacks will add those test cases to be judged on all subsequent submissions, which adds a non-small load to the Codeforces server while serving no purpose. It's forbidden to hack solutions that intentionally contains a mistake in uphacking, but there's no rule that says the same during actual contest, unfortunately)
  • The remaining 2 (1 2) looks like genuine hacks, but given that there are a lot of previous TL hacks, it's likely that even if they don't do that those submissions will eventually fail in the final standings. (because after the open hacking phase, all submissions are judged against all successful hack test cases)
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Because it's better than being hacked by others. also it's useful to train spotting mistakes.