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://codeforces.net/contest/1335/problem/E2
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
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://codeforces.net/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://codeforces.net/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