When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

A little confusion on unordered map complexity

Revision en1, by Hz_, 2020-11-19 09:13:38

Problem: https://codeforces.com/contest/978/problem/F

Solution 1(TLE): https://codeforces.com/contest/978/submission/98839909

Solution 2(AC): https://codeforces.com/contest/978/submission/98859922

Here, in solution 1, I used 3 unordered map and getting TLE but when I used 2 unordered map on solution 2 it gets AC. Why this happened while unordered map searches, inserts, and deletes elements in O(1)?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Hz_ 2020-11-19 09:13:38 620 Initial revision (published)