#include #include #include #pragma warning(disable:4996) using namespace std; vector > > g; // target vertex, directed edge vector visedge; // visit flag for each directed edge bool dfs(int paredge, int curr) { auto it=g[curr].begin(); while(it!=g[curr].end()) { int next=it->first; int edge=it->second; if(edge/2==paredge/2) { ++it; continue; } if(visedge[edge]) { return true; } visedge[edge]=1; if (dfs(edge, next)) { return true; } it=g[curr].erase(it++); // erase finished edge } return false; } void solve(int n, int m, const vector& a, const vector& b, const vector c) { g.resize(n); visedge.resize(m*2); int i; for(i=0; i a(m),b(m),c(m); int i; for(i=0; i