minus_M1's blog

By minus_M1, history, 6 hours ago, In English

So I recently saw this problem in one of the blogs and someone claimed to have solved is using brute force, so I gave it a try and it seems that this 3100 rated has weak tc. When I tried to submit using some optimisations, it got accepted (311356622). Can anyone tell any reason why is it so?

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

»
6 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

It's probably not that there are weak testcases but that it's a badly set problem. You've got 3s TL with $$$10^5$$$ constraints that can be answered in very lightweight $$$O(N)$$$ — that's just asking for trouble. It's a common difficulty as a problemsetter to cleanly differentiate a heavy solution that has a better asymptotic complexity versus a very light solution with worse asymptotic complexity, while also keeping the time limit within reason — and it just seems the authors failed to do that here.

So yeah, the optimizations do help a lot, but if the problem was set with more care, it still wouldn't pass. The author in the editorial apologizes for not testing with pragmas, and it's a very old contest so fair enough — it's a more common trick nowadays (which I think shouldn't be allowed, but I digress)

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

    Thanks for clarifying!