Submission #583940

#TimeUsernameProblemLanguageResultExecution timeMemory
583940PiejanVDCToy Train (IOI17_train)C++17
0 / 100
806 ms1048 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; const int mxN = (int)5005; vector<int>adj[mxN]; vector<int>who_wins(vector<int>a, vector<int>r, vector<int>u, vector<int>v) { int n = r.size(); int m = u.size(); for(int i = 0 ; i < m ; i++) { adj[u[i]].push_back(v[i]); } vector<int>ans(n,0); for(int i = 0 ; i < n ; i++) { vector<bool>vis(n,0); vis[i] = 1; stack<int>s; s.push(i); while(!s.empty()) { int node = s.top(); s.pop(); if(r[node]) ans[i] = 1; for(auto z : adj[node]) if(!vis[z]) { vis[z] = 1; s.push(z); } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...