This is just unfair that my PyPy submission got TLE! Can this be reviewed?
# | User | Rating |
---|---|---|
1 | jiangly | 3898 |
2 | tourist | 3840 |
3 | orzdevinwang | 3706 |
4 | ksun48 | 3691 |
5 | jqdai0815 | 3682 |
6 | ecnerwala | 3525 |
7 | gamegame | 3477 |
8 | Benq | 3468 |
9 | Ormlis | 3381 |
10 | maroonrk | 3379 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 165 |
3 | Dominater069 | 161 |
4 | atcoder_official | 160 |
5 | Um_nik | 159 |
6 | djm03178 | 156 |
7 | adamant | 153 |
8 | luogu_official | 151 |
9 | awoo | 149 |
10 | TheScrasse | 146 |
This is just unfair that my PyPy submission got TLE! Can this be reviewed?
Name |
---|
skill issue
because python is slow. I also got TLE on test 42 214898344, and the C++ code is Accepted 215049350
Its not an issue related to python slowness, but its related to hash collisions being o(n^2)
sort the array before you use counter and it should pass.
https://codeforces.net/contest/1850/submission/215081606 Passes in 200 ms
nice, new knowledge, thank you
WOW! it worked! can you please give a brief explanation on why this is the case? How does sorting the array decrease hash collisions? very counter intuitive !
I tried the same for G as i also used a dictionaries there. it passed test case 14 but unfortunately it still got TLE on test 17. Is there anything i could do with that? Problem G submission
can u explain why sorting the list reduced the runtime?
People have designed the testcase to cause hash collision resulting in n^2. If you sort the array you get rid of the hash collision as elements are inserted in a different order, resulting in o(n)