There is a strange thing between C++14 and C++20
We can see that the down two code are same, but the code using C++20 got TLE, and the code using C++14 got AC
https://codeforces.net/contest/1634/submission/145631828
https://codeforces.net/contest/1634/submission/145633066
We can also see that the down two code are same, but the code using C++14 got TLE, and the code using C++20 got AC
https://codeforces.net/problemset/submission/573/145373496
https://codeforces.net/problemset/submission/573/145372752
What's wrong with it? It there anyone could help me answer the question? Many Thanks!
in the second case, it is due to the 64-bit version of the compiler.
C++20(64-bit) is absolutely faster than C++20.
One of my friends named EasonTAO debugged the whole night and submitted for 94 times and got all TLE because he used C++20. Later he used C++20(64-bit) and submitted the same code and got AC.
It was really surprising.
Here is his submission.
143979222
That's really amazing that C++(64-bit) can run so fast.
hahaha I used C++17(64-bit) and got AC while it's O(N^2) and N=1e5 :)
That's true. It seems that legacy problems can be passed with even the naive solution.:)
hahaha I used C++17(64-bit) and got TLE while it's O(N^2) and N=1e4 :)
NO,I got TLE because I used C++14,Two hours later,I used C++17(64 bit) and submitted the same code and got AC.
I'm very suprised when I got AC.
I was very surprised at that time too.
By the way, using O3 is also important when you are dealing with a qualmish problem.
Why not Ofast
There is Ofast too
I used O3,O2,Ofast and many other amazing things
You used the O3 I gave to you
At that time I was suprised that cin is faster than scanf!
yeah, and also faster than read(int &x) once I got TLE(501ms) while using read() :(
Someone's "Fast Read":
()()()
EasonTAO, yyds!