Skip to content

Instantly share code, notes, and snippets.

@kuoe0 kuoe0/d151.cpp
Created Dec 8, 2011

Embed
What would you like to do?
bool DFS( int now, int cnt ) {
visit[ now ] = 1;
bool ret = 0;
if ( now == tgA )
ret = BFS( 1 );
if ( !cnt || ret ) {
visit[ now ] = 0;
return ret;
}
for ( int i = 0; i < 2; ++i ) {
int next = vertex[ now ][ i ];
if ( !visit[ next ] && DFS( next, cnt - 1 ) )
return 1;
}
visit[ now ] = 0;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.