# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
646179 |
2022-09-29T02:15:43 Z |
jamezzz |
Toy Train (IOI17_train) |
C++17 |
|
2000 ms |
262144 KB |
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define maxn 5005
typedef vector<int> vi;
bool vis[maxn];
vi AL[maxn],RAL[maxn];
bool dfs(int u,int rt){
vis[u]=true;
for(int v:AL[u]){
if(v==rt)return true;
if(vis[v])continue;
if(dfs(v,rt))return true;
}
return false;
}
vi who_wins(vi a,vi r,vi u,vi v){
int n=a.size(),m=u.size();
vi ans(n,0);
for(int i=0;i<m;++i){
AL[u[i]].push_back(v[i]);
RAL[v[i]].push_back(u[i]);
}
for(int i=0;i<n;++i){
for(int j=0;j<n;++j)vis[j]=false;
if(r[i]&&dfs(i,i)){
queue<int> q;
q.push(i);
while(!q.empty()){
int u=q.front();
if(ans[u])continue;
for(int v:RAL[u]){
ans[v]=true;
q.push(v);
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
1236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
369 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1492 KB |
Output is correct |
2 |
Correct |
24 ms |
1620 KB |
Output is correct |
3 |
Correct |
41 ms |
1748 KB |
Output is correct |
4 |
Runtime error |
429 ms |
262144 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
426 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
333 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
1236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |