/* to do 有効グラフ */ #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=1e9+7; int main(){ int N; cin>>N; map mp; vector X(N); vector A(N); for(int i=0;i>X[i]; } for(int i=0;i>A[i]; } for(int i=0;i> G(N),rG(N); for(int i=0;i visit(N,false); vector seen(N,false); vector finish(N,false); vector dist(N,0); for(int i=0;ill{ //cout<<"now="<