Aritro_Sarkar's blog

By Aritro_Sarkar, history, 4 weeks ago, In English

Today, I was trying to solve This Problem and This was my solution which got TLE in test 5. (in C++ 17)

Except it's not supposed to.

I calculated the time complexity and it is way smaller than the time limit.

I tried submitting the same solution in C++ 20 13.2 (64 bits, winlibs) Here, which is Accepted.

They are the same solution but in different languages.

I knew that C++ 17 differs from C++ 20, but I didn't know it did that much.

If this happened to me in a contest, I would probably break something.

So, I will never submit a solution in C++ 17 ever again. (And keep my belongings safe)

Anyways, if anyone knows why it's like that, please let me know.

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

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I think C++17 is faster then C++20

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But that doesn't change the fact that I got TLE in C++ 17 but AC in C++ 20 with the same code. How is C++ 17 faster then?