ABC119 Task C

Would you please explain how to solve this question ABC119 Task C with dfs.

I think reading the correct code from others will be useful to you.

1 Like

Google translate of editorial. Although text is a bit unaligned. But still its readable and sufficient.

P.S. Dfs is just a fancy name here. Nothing related to graphs here.

1 Like