unt311's blog

By unt311, history, 4 years ago, In English

I am very unhappy with getting TLE in recent contests for submissions that were of the exact same complexity as the editorial I saw afterwards :

  1. Happened in D problem of the latest Div3. My nlog(n) submission didn't pass(TLE).

  2. Again happened in C problem of Divide by zero contest. My O(n) solution didn't pass (TLE).

  3. Again happened today problem B (last div2) My optimal solution didn't pass (TLE) (Editorial isn't out yet, but I wasn't expecting TLE at all)

Do I mess up everytime or is CF behaving unfair with me ?

  • Vote: I like it
  • -22
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it +24 Vote: I do not like it
  1. I replaced {} with 0 which now gives runtime error 112878381
»
4 years ago, # |
  Vote: I like it +64 Vote: I do not like it
  1. That's because of undefined behaviour. You sometimes erase an element which doesn't exist, which can in some cases lead to TLE. AC code: 112879774

  2. I removed 1 instance of // from your code and now it doesn't TLE. 112879724

  3. You get an infinite loop on the input

1

9 9 9

In conclusion, you mess up every time.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Now, when I take care of the element I was deleting twice, I get a WA. Please have a look — submission

    I've thought multiple times over and can't find anything wrong now atleast.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      s.erase(a[n - 2]); should be replaced by s.erase(s.find(a[n - 2]));

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Unless you see 1000's of people complaining about a strange bug, its most likely you who is messing up.

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

In 2nd problem use int instead of long long, I also got TLE with long long, but int got AC. TLE: 112759305 AC: 112759480