Open dev-onejun opened 1 year ago
using dfs and count the consecutive vertices which has cat, and pop if the path were out of conditions so that don’t search that path anymore.
https://codeforces.com/contest/580/submission/195526550 -> Wrong answer on test 8
https://codeforces.com/contest/580/submission/195758389 -> Accepted
undirected graph
and count if the arrived node is leaf.
https://codeforces.com/problemset/problem/580/C