gamegame's blog

By gamegame, 7 years ago, In English

I recently participated on Codeforces Round 402 (Div. 1) and my code to problem A passed pretests with this.

http://codeforces.com/contest/778/submission/25032443

On line 31 there is this

"mid=(left+right)+1/2;"

My whole binary search is wrong but it still passed pretests

Should the pretest be set such that at least codes with this kind of mistakes shouldn't pass the pretests?

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

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

Auto comment: topic has been updated by gamegame (previous revision, new revision, compare).

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

The solution is not wrong, it is slow: the right bound is actually decreased by 1 in every iteration.

There are no hard rules about what goes into pretests and what doesn't. They are the result of a reasonable trade-off between checking for the most stupid errors and keeping the system tests and hacks eventful. Additionally, problem setters probably won't think of every possible stupid error since there are just too much, and their categorization of errors into pretest errors and main test errors may also vary with yours. So, I'd not rely on pretests too much.

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

Man don't get sad

here I sent a code for completely another problem and it passed the pretests

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

    If it helps , I had atleast 2 solutions which passed pretests and failed main tests in last 4 contests :'(

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

Sometimes pretests are too weak and its okay.

See This

Pretests had no case where answer was 0.