Link to my source code https://ideone.com/q83VDg. I am getting TLE in test case 14 but my complexity if O(N*200). Please take a look and tell me if I am wrong.Link to the problem http://mirror.codeforces.com/contest/1335/problem/E2
# | User | Rating |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 162 |
3 | Um_nik | 161 |
4 | atcoder_official | 160 |
5 | djm03178 | 157 |
5 | Dominater069 | 157 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 148 |
Link to my source code https://ideone.com/q83VDg. I am getting TLE in test case 14 but my complexity if O(N*200). Please take a look and tell me if I am wrong.Link to the problem http://mirror.codeforces.com/contest/1335/problem/E2
Name |
---|
Map operations are not constant, they are logarithmic. It may not seem as significant, but N*200*lgN will surely get TLE.
I replaced map with 2d array but now I am getting MLE code https://mirror.codeforces.com/contest/1335/submission/77007251
The size of array is too big (200002 * 200). You can try unodered_map with run in O(1) complexity or you can change the algorithm you using