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 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | 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://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