It's the first problem for me to solve with DFS , So I can't understand why it's wrong Answer on test 6 The link of code and submission : http://codeforces.me/contest/580/submission/30840380 Problem link : http://codeforces.me/problemset/problem/580/C