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

Автор akulsareen, 10 лет назад, По-английски

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?

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

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

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

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

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 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.