# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134873 | 2019-07-23T11:07:39 Z | amiratou | Toy Train (IOI17_train) | C++14 | 1450 ms | 1424 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> A,R; int n; vector<vector<int> > vec; int vis[5001]; int dfs(int node,int e,int charge){ if(R[node])e=n,charge=1; //cerr<<node<<" "<<e<<"\n"; if(!e)return 0; if(vis[node]!=-1){ if(charge)return 1; else return 0; } vis[node]=e; for(auto child:vec[node]){ int ans=dfs(child,e-1,charge); if(A[node]&&ans==1)return 1; if(!A[node]&&ans==0)return 0; } return !A[node]; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { //cerr<<"\n----------\n"; A=a,R=r; n=a.size(); vec.resize(a.size()); for (int i = 0; i < u.size(); ++i) vec[u[i]].push_back(v[i]); vector<int> res(n); for (int i = 0; i < n; ++i){ memset(vis,-1,sizeof vis); res[i]=dfs(i,n,0); //cerr<<"\n----------\n"; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 888 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 230 ms | 1424 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1258 ms | 1144 KB | 3rd lines differ - on the 75th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1450 ms | 1228 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 888 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |