pgiaminh8368's blog

By pgiaminh8368, history, 5 years ago, In English

So I was doing this problem: https://codeforces.me/contest/1490/problem/F. And I got TLE when I use C++11: https://codeforces.me/contest/1490/submission/144339905 . and C++14: https://codeforces.me/contest/1490/submission/144338420 . but AC when using C++20: https://codeforces.me/contest/1490/submission/144339955 . Can anyone tell me why this is happening?

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

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

»
5 years ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Change unordered_map to map . Time complexity of unordered_map on average is O(1) but it's worst case complexity is O(n)

https://codeforces.me/contest/1490/submission/144341577