I was wondering why the exact same code
https://codeforces.net/contest/833/submission/53432006
gets a TLE on test 8 when submitted in C11 but
https://codeforces.net/contest/833/submission/53431981
gets AC when submitted in G++14. Does the C++ compiler optimize the operations or something? If I'm not wrong the complexity of this solution should be O(n log max(a*b)) (I assumed the complexity of cuberoot is log n, I don't actually know what it is).
Auto comment: topic has been updated by Hyperlink_Blocked (previous revision, new revision, compare).
It's most likely a problem with I/O. I used custom invocation to output INT_MAX 300000 times (the number used in the failing test case). The code remained the same for both tries. I used printf. The results:
C11: 1045 ms
C++14: 93 ms
hahaha that was funny ! : )) I have never senn that : ||