This is the problem from yesterdays cook-off, there is no solution given but I have seen others submission and found that there algo is O(q*180) which exceeds 10^8 for q=10^6
It should give TLE right ?
Is that because time limit is set to 4sec and O(q*180) is also accepted ?
In fact, the runtime is not simply limited to 1e8 counts. It is affected by many things, such as
#pragma GCC optimize("Ofast", "inline","-ffast-math") which can speed up the runtime significantly, or the fact that the segment tree is much slower than the fenwick tree for the same n log n.
So it is acceptable that the 1.8e8 computational code is passed. However, I don’t recommend writing code close to the bounded runtime, which can easily lead to unexpected TLEs due to CPU computation speed fluctuations.