Hyperlink_Blocked's blog

By Hyperlink_Blocked, history, 6 years ago, In English

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).

  • Vote: I like it
  • +10
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Hyperlink_Blocked (previous revision, new revision, compare).

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

hahaha that was funny ! : )) I have never senn that : ||