akulsareen's blog

By akulsareen, 10 years ago, In English

I had to resubmit an old solution of mine on Codeforces. So I took my old solution, which had a lot of individual #includes in it, replaced them all with one common #include <bits/stdc++.h> and resubmitted.

Surprisingly, my old solution, which gave an AC, gave TLE on case 6 after the change.

Links:

Old solution

New solution

Could someone please point out what happened here?

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

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

Thats really weird... Here both codes ended up in TLE

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

I've resubmitted your first submission and got TL too (10349435).

It's kinda weird, because it took 0.3s to run on test #6 in 2014, which is more than three times smaller than TL.

Probably it happened because of GCC update, same code gets OK with Visual Studio (10349485) right now.

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

    I resubmitted my old solution and got TLE too.

    Although, adding ios_base::sync_with_stdio(0) seems to speed it up back to its exact original time.

    The update reason seems to make sense. Thanks a lot.