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://mirror.codeforces.com/contest/580/submission/30840380 Problem link : http://mirror.codeforces.com/problemset/problem/580/C