Блог пользователя MedoN11

Автор MedoN11, история, 7 лет назад, По-английски

Hello, I was recently solving this problem : http://mirror.codeforces.com/contest/35/problem/E

My solution uses line sweep here : http://mirror.codeforces.com/contest/35/submission/27660692

It gets MLE on the first sample test case + 1200+MS. Now when I run this on custom invocation without reading/writing into file I get :

Used: 15 ms, 4 KB

Is it possible to get past this MLE ? Can someone explain what is going on?

Thanks !

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Note that the problem statement asks you to read from file and output to a file. You don't do that in the very first lines of the code — you read n from the standard input. scanf fails and behavior of any code afterwards which relies on n is undefined. In particular, you've got MLE on this test case. Don't try to find logic here — it's undefined behavior.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Now that's another stupid mistake to add on my list..

    Thank you for the help. AC now. :)