It’s been a while since the last Codeforces contest. I really wish there were more of them.
| # | User | Rating |
|---|---|---|
| 1 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3447 |
| 6 | Um_nik | 3387 |
| 7 | heuristica | 3322 |
| 8 | turmax | 3317 |
| 9 | tourist | 3307 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 143 |
| 5 | Errichto | 139 |
| 6 | adamant | 137 |
| 7 | AmShZ | 135 |
| 8 | maroonrk | 133 |
| 9 | BledDest | 132 |
| 10 | qwexd | 129 |
It’s been a while since the last Codeforces contest. I really wish there were more of them.
In competitive programming, we often use map or unordered_map. However, choosing the wrong container can sometimes cause our code to hit a Time Limit Exceeded (TLE). Today, I will share with you why the unordered_map get TLE ?
1.Hash collisions → Worst case O(n) instead of O(1). 2.Adversarial inputs → Test cases designed to break default hash. 3.String hashing cost → Large strings slow down lookups. 4.Higher constants → More memory & overhead than map.
https://codeforces.me/problemset/problem/2131/C
In this problem, using unordered_map in the same code will lead to a TLE, whereas replacing it with map in the exact same scenario will result in an Accepted verdict.
So always use a custom hash if you don't want to get blown up.
| Name |
|---|


