Today,I'm solving abc331_f.I used brute force at that moment.Its time complexity is $$$\Theta(nq)$$$ which $$$n$$$ is not greater than $$$10^6$$$ and $$$q$$$ is not greater than $$$10^5$$$.but I passed it in about $$$1$$$ second.
Soon I found the problem:I used C++23 Clang 16.0.0 to submit it in the beginning and it passed,but when I used C++20 gcc 12.2 to submit it,it got TLE.
So please can somebody tell me the reason?Thanks.
And here's my code.