TLE with C++17 but AC with C++14 [UWCOI20D]

In yesterday’s contest, I wrote a solution for this Problem

When i submitted in C++17, It gave me TLE for the last case, and i spent over 20 mins optimizing the code but no luck.

Then I copy paste and submit it in C++14, and magically the verdict changed to AC.

C++17 Code TLE
C++14 Code AC

These two codes are copy-pasted

Is this normal? anyways i won’t use C++17 ever now XD

Sometimes this happens for me in codeforces,surprising to know that it happened in codechef .

This is my first time experiencing it lol, it (almost) screwed up my contest yesterday because i wasn’t able to figure out what’s wrong

Similar to this

Your code runs in 0.89 seconds on C++14 and in 1.02 seconds on C++17. This amount of difference is not surprising, and is in no way evidence that C++17 is slower in general. There are definitely many codes which run slightly faster in C++17 than in C++14.

6 Likes

So should we use c++14 in codechef?

ok thanks :slightly_smiling_face:

I checked your submissions for both c++14 & 17. As of now both are AC. Did you changed the links? Also the c++17 submission is faster in given link. for c++14 - 0.89secs while c++17 - 0.39secs. I am reading this on 2 May like after 3 months past the original post. How does the submission status is changed I dont understand. ;(