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.
I think C++17 is faster then C++20
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?