№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
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 | nor | 152 |
Название |
---|
If they would have been the same, then it wouldn't have failed on 21.
Can you help me matcoder without an 'h'??
I am sorry, but I tried to look at the codes. The only thing I found that would result in Wrong Answer is that no function in the second code has been called recursively (which may cause local flags to be set only once) and there are two conditions while checking (only 1 in the first code).
Not sure though. But I'll have a closer look at it again if the query persists after a day too.
The two conditions in 2nd code are analogous to one condition in 1st code as s and p are connected and c==p case is handled as there is no self edge.
If you want help, write nice code with comments and meaningful variable names. And explain your solution.
Your two solutions differ a lot. In your WA solution, you only consider edges $$$(p, s)$$$ that belong to some spanning tree. In other words, you don't go through all edges $$$(p, s)$$$. Note that there are $$$M$$$ edges while DFS function will run only $$$N$$$ times in a connected graph.