# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425820 | 2021-06-13T11:41:45 Z | Rouge_Hugo | Toy Train (IOI17_train) | C++14 | 1116 ms | 1480 KB |
#include<bits/stdc++.h> #include "train.h" #define ll long long #define fi first #define se second #define pb push_back using namespace std;int n,m; vector<int>ans; const int N=5090; int vis[N],yes[N];int o; vector<int>v[N]; int rr[N]; void d(int x) { if(x==o&&vis[x])yes[x]=1; if(vis[x])return; vis[x]=1; for(auto it:v[x]) { d(it); } } int dfs(int x) { if(vis[x])return 0; if(yes[x])return 1; vis[x]=1;int z=0; for(auto it:v[x]) { z=max(z,dfs(it)); } return z; } vector<int> who_wins(vector<int> A,vector<int> r,vector<int> u,vector<int> uu) { n=r.size();m=u.size(); for(int i=0;i<n;i++) rr[i]=r[i]; for(int i=0;i<m;i++) v[u[i]].pb(uu[i]); for(int i=0;i<n;i++) { if(rr[i]==0)continue; memset(vis,0,sizeof vis); o=i; d(i); } for(int i=0;i<n;i++) { memset(vis,0,sizeof vis); ans.pb(dfs(i)); } return ans; } /* 6 7 1 1 1 1 1 1 0 0 0 0 0 1 1 2 2 0 0 1 4 2 3 3 2 5 5 0 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 102 ms | 940 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 | 1 ms | 332 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 168 ms | 1328 KB | Output is correct |
2 | Correct | 186 ms | 1300 KB | Output is correct |
3 | Correct | 215 ms | 1272 KB | Output is correct |
4 | Correct | 1095 ms | 1304 KB | Output is correct |
5 | Correct | 861 ms | 1148 KB | Output is correct |
6 | Correct | 630 ms | 1244 KB | Output is correct |
7 | Correct | 270 ms | 1040 KB | Output is correct |
8 | Correct | 279 ms | 1080 KB | Output is correct |
9 | Correct | 273 ms | 1220 KB | Output is correct |
10 | Correct | 435 ms | 1188 KB | Output is correct |
11 | Correct | 297 ms | 1068 KB | Output is correct |
12 | Correct | 31 ms | 972 KB | Output is correct |
13 | Correct | 1057 ms | 1336 KB | Output is correct |
14 | Correct | 1056 ms | 1248 KB | Output is correct |
15 | Correct | 1071 ms | 1480 KB | Output is correct |
16 | Correct | 1076 ms | 1368 KB | Output is correct |
17 | Correct | 1064 ms | 1340 KB | Output is correct |
18 | Correct | 429 ms | 1056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 785 ms | 1000 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1116 ms | 1208 KB | 3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 102 ms | 940 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |