While submitting my answer to question Round #236 Question E, using GNU C++11 compiler, i got TLE at testcase #11. Initially, I thought that it might be due to my algorithm being inefficient. But after various attempts, i kept getting TLE on testcase #11.
Giving up to solve the question, i looked upon the accepted solutions on the leader-boards. To my surprise, my algorithm was similar to theirs.
I thought that it may be due to compiler. I tried to use 3 standards C++11, C++14 and C++17 (on gnu g++ compiler), at upper limit constraints, my local machine gave timings well below time limit.
But, on changing compiler to GNU C++14 and GNU C++17 on codeforces, both gave accepted verdict, but same code on GNU C++11 gave TLE.
Can someone clarify why this happened?
My submissions:
Using GNU C++11, TLE verdict 84164094.
Using GNU C++14, accepted verdict 84164037.
Using GNU C++17, accepted verdict 84164239
P.S. I am not used to asking questions, sorry if anything gets confusing or has incomplete information.