Hello everyone. If it took you a short time to implement C2 last contest, can you please share your solution? I'd really appreciate it.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 165 |
2 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Hello everyone. If it took you a short time to implement C2 last contest, can you please share your solution? I'd really appreciate it.
Name |
---|
Here's mine, took a while to think of it but implementation was pretty smooth: 284569514
The strategy I used was:
I believe a recent problem can be solved similarly
2002D1 - DFS Checker (Easy Version)
Another small trick I used was: if an edge case is hard to handle, consider mutating the input so it can't happen. To avoid dealing with the case where a person doesn't appear in b at all, I append a to the end of b, which doesn't affect the answer (edit: now that I think about it, it isn't that hard to handle, but committing to this while thinking of the algorithm made it easier to not have to keep track of it)
This does seem like a smooth way to do it. Thank you for explaining.