Please subscribe to the official Codeforces channel in Telegram via the link ×

MedoN11's blog

By MedoN11, history, 6 years ago, In English

Hello, I was recently solving this problem :

My solution uses line sweep here :

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 !

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

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.

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

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

    Thank you for the help. AC now. :)