Hi CF community!
I was practicing some virtual contests recently and I happened to run into a very peculiar compilation issue. I was trying this problem and for some reason, I kept getting TLE on test case 1, submission here with limit at 2s. It frustrated me to no end because the code is really short and it cannot possibly TLE on the sample test case unless I am losing my mind.
Then, in sheer desperation, I decided to change the compiler to G++17 from G++20, and voila, accepted in like 100ms!
I am not very familiar with the differences in compilation please, can someone educate me on why this happened and how to prevent it in the future? Thank you in advance.
Assuming m = 1, when your multiset is empty (at first) and you call its begin, that causes the issue
I see, thanks for pointing it out. So for some reason the compilers treat it differently then? Because I had no issues running the sample test case on my local, where my compiler is also set to C++20
Also shouldn't the checker be throwing a Runtime Error instead of a TLE when something is accessed that doesn't exist? Ideally my local should have done it too, but that might be fixable tweaking around with different versions of the compiler.
Because this is a Undefined Behavior.A program that is Undefined Behavior will could have any result.Like the joke in China,Undefined Behavior is meens Launching Genshin Impact with the program is also legal.