# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296815 | 2020-09-10T22:19:19 Z | DanerZein | Toy Train (IOI17_train) | C++14 | 356 ms | 262148 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; vector<vi> G; bitset<5010> ab,cs,cl; int vis[5010]; vi res,path; int n; bool dfs(int u){ vis[u]=1; if(ab[u] and cs[u] and cl[u]){ return res[u]=1; } if(!ab[u] and !cs[u] and cl[u]){ return res[u]=0; } bool ans=0; for(auto &v:G[u]){ ans=dfs(v); } return res[u]=ans; } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { n=a.size(); for(int i=0;i<a.size();i++){ ab[i]=a[i]; cs[i]=r[i]; } G.resize(n+1); res.resize(n); for(int i=0;i<u.size();i++){ int x=u[i],y=v[i]; if(x!=y) G[x].push_back(y); if(x==y) cl[x]=1; } memset(vis,-1,sizeof vis); for(int i=0;i<n;i++){ if(vis[i]==-1){ res[i]=dfs(i); } } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Incorrect | 4 ms | 768 KB | 3rd lines differ - on the 4997th token, expected: '1', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 203 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 356 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 206 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 209 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Incorrect | 4 ms | 768 KB | 3rd lines differ - on the 4997th token, expected: '1', found: '0' |
3 | Halted | 0 ms | 0 KB | - |