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 | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
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