# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775918 | 2023-07-07T07:07:43 Z | ttamx | Toy Train (IOI17_train) | C++14 | 1558 ms | 1620 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); 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]){ 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]=1; for(auto v:radj[u])rdfs(v); }; rdfs(i); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 159 ms | 1236 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 | 0 ms | 212 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 | 9 ms | 1364 KB | Output is correct |
2 | Correct | 20 ms | 1512 KB | Output is correct |
3 | Correct | 43 ms | 1556 KB | Output is correct |
4 | Correct | 533 ms | 1528 KB | Output is correct |
5 | Correct | 59 ms | 1472 KB | Output is correct |
6 | Correct | 61 ms | 1364 KB | Output is correct |
7 | Correct | 505 ms | 1340 KB | Output is correct |
8 | Correct | 6 ms | 1364 KB | Output is correct |
9 | Correct | 5 ms | 1364 KB | Output is correct |
10 | Correct | 8 ms | 1252 KB | Output is correct |
11 | Correct | 6 ms | 1236 KB | Output is correct |
12 | Correct | 5 ms | 1236 KB | Output is correct |
13 | Correct | 6 ms | 1492 KB | Output is correct |
14 | Correct | 8 ms | 1520 KB | Output is correct |
15 | Correct | 6 ms | 1536 KB | Output is correct |
16 | Correct | 8 ms | 1620 KB | Output is correct |
17 | Correct | 7 ms | 1512 KB | Output is correct |
18 | Correct | 120 ms | 1236 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1558 ms | 1336 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 | 6 ms | 1492 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 | 159 ms | 1236 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |