Hey MikeMirzayanov In the recent div2 contest, I encountered an issue where my code for Problem D, "A Wide, Wide Graph," resulted in a TLE. However, I submitted the same code today and it was accepted.
Tle Submission:Tle
Ac Submission:AC
# | 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 |
Hey MikeMirzayanov In the recent div2 contest, I encountered an issue where my code for Problem D, "A Wide, Wide Graph," resulted in a TLE. However, I submitted the same code today and it was accepted.
Tle Submission:Tle
Ac Submission:AC
Name |
---|
998ms means about to TLE
Ya ik it is very close to time limit but because of unconsistency may be due to load on site sometimes it is just below and sometimes it is just above the time limit
this, i think, means that this isn't the intended complexity, it just happened to be >=2ms faster the second time. This is precisely the reason why many coders would submit multiple solutions to a problem trying to get their runtime down, to make sure it wasn't a fluke.
Still, interesting situation though.
Also 18o3 orz.
🤡 🤡 🤡
As far as the logic is concerned and intended complexity it is fully fine it is just the time python takes
Use PyPy3 instead, it would much faster.
With dfs it gives runtime more so python 3 is best choice for dfs related stuff
For dfs, I recommend you convert dfs to stack version. I was in the same situation in the past.
At that time, I try to 2 experiments:
Use python3 and set a recursion limit, it's work but need carefully when choose a recursion limit.
Continue use Pypy3 (it isn't work with set a recursion limit -> memory error). I convert dfs to stack version
Although both ways can AC but Pypy3 still faster and stable than Python 3 version (both recursion and stack implementation) in run time.
converting to stack version makes the problem tough for sure . like it makes +100 tougher