micklepru's blog

By micklepru, history, 9 years ago, In English

Hello, Codeforces!

You are on a contest. Invented and implemented solution. Tested it good amount of time. With absolutely confident motion you click SUBMIT and... get WA #PUT_A_BIG_NUMBER_HERE.

You double-checked everything and convinced yourself that your solution is flawless. Or maybe you found and fixed some insignificant bugs and resubmit with same result.

Your logic tells you: "Solution passed so many tests. It cannot be wrong!"

You look at the timer. Seconds go faster than ever in your life. And you just sitting there helpless/in panic with (almost)SOLVED task.

Contest finishes, you understand that this problem COULD move you like 10/100/1000/... positions up in standings.

I believe most of you has encountered such a moment. As for myself, this happens to me unacceptably often. And every time it brakes my mood in pieces. And worst of all, I cannot do anything to prevent this in future. And it happens over and over again.

I ask you for advice, guys. What should one do in such situations?

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

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

Stop caring too much about ranks, and actually enjoy competitions for what they are. Sure ranks are cool, but the moment you base your mood around them, is the moment you need to look back, and realise why are you doing this.

Let's say you mess up, and end up last you nearly have a contest every week to do better. I can understand why would someone be worried about a yearly competition like ICPC or IOI as they are once per year, So you lost 100 or 200 points this one? You have endless competitions to do better.

tl;dr? stop caring about your rank.

»
9 years ago, # |
Rev. 3   Vote: I like it +7 Vote: I do not like it

Every time that happens to you just check after the contest what mistakes you were doing, and make sure that you will not make any mistakes of the same kinds in the future. it's ok if you make mistakes of other kinds in the future , but make sure that you not will repeat the same mistakes.

after some contests that situation will not happen to you because the number of kinds of mistakes is finite

  • »
    »
    9 years ago, # ^ |
    Rev. 4   Vote: I like it +6 Vote: I do not like it

    Fixed.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it
    make sure that you will not make any mistakes of the same kinds in the future

    Easy to say... :)

    Your logic tells you: "Solution passed so many tests. It cannot be wrong!"

    Never think about it in this way. You got WA? Either tests are bad, or your solution is wrong. That's how your logic should work. Maybe this solution doesn't work because of bad idea, maybe because of small bug. Maybe your idea is OK — but your solution in general isn't.

    BTW, here is a solution to a problem (12318090) involving LCA, which reached WA59 (that problem has 65 tests) with not working LCA :)

    double-checked everything and convinced yourself that your solution is flawless

    Once again it sounds like you are going to tell admins/setters that they have an issue with a problem — because you convinced yourself that your solution is flawless. You aren't, right? Instead you'd better convince yourself that it is wrong — no matter how good/flawless/obvious it looks and sounds. For me it sounds harder to find a bug thinking "no, no way, it can't be wrong, it should work perfectly, I checked everything".

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

      Easy to say but not impossible to do, if you forgot long long , remember next time to change your ints to long long when necessary , if you didn't allocate enough array size then be careful next time on the problem constraints , etc.

      if you repeated a mistake then this doesn't mean that this plan has failed, just be more careful for this particular mistake , and check your code from the mistakes that you usually repeat before you submit it.

      if you concentrate enough this will not be hard.

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

Last time i had a bug when i didnt use long long's, which cost me about 300 positions. Then i read comments of Petr about losing the Yandex and Div1 contests because of stupid bugs, and i wasnt so frustrated anymore ...

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

This has happened to me countless times during onsite and online competitions. Passing so many tests usually means your solution is correct but you have some minor bug. Now you have a few options:

1) Debug by hand. Since it is a minor bug there is a huge chance that it is simply some corner case or a max test (array out of bounds for example) so checking that first is the best way to go.

2) Debug automatically. This is the safest and best way to find your mistake. If it is a mistake that is not strictly happening at large tests, then running a few thousand small testcases will almost certainly find a buggy testcase. The downside of this method is that it requires a test generator and a slow solution which may take some time.

If the automatical debug doesn't work, then your mistake is either on some very very rare corner case or it is big-test only mistake, so try to look for array-out-of-bounds things. Of course sometimes nothing works out and you sit there frustrated, but automatic debug has helped me in almost all cases :)