# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775920 | 2023-07-07T07:11:07 Z | ttamx | Toy Train (IOI17_train) | C++14 | 2000 ms | 262144 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> U, vector<int> V) { int n=a.size(); vector<int> ans(n,1); vector<vector<int>> adj(n),radj(n); for(int i=0;i<U.size();i++){ int u=U[i],v=V[i]; adj[u].emplace_back(v); radj[v].emplace_back(u); } for(int i=0;i<n;i++){ if(r[i])continue; vector<bool> vis(n); function<void(int)> dfs=[&](int u){ for(auto v:adj[u]){ if(!vis[v]||r[v]){ vis[v]=true; dfs(v); } } }; dfs(i); if(!vis[i])continue; vector<bool> rvis(n); function<void(int)> rdfs=[&](int u){ if(rvis[u])return; rvis[u]=true; ans[u]=0; for(auto v:radj[u])rdfs(v); }; rdfs(i); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 127 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 309 ms | 1708 KB | Output is correct |
2 | Correct | 386 ms | 1700 KB | Output is correct |
3 | Correct | 442 ms | 1680 KB | Output is correct |
4 | Execution timed out | 2065 ms | 1492 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 142 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2074 ms | 1500 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 127 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |