# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
646180 |
2022-09-29T02:16:08 Z |
jamezzz |
Toy Train (IOI17_train) |
C++17 |
|
308 ms |
1712 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();
q.pop();
if(ans[u])continue;
for(int v:RAL[u]){
ans[v]=true;
q.push(v);
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
81 ms |
1364 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
3rd lines differ - on the 3rd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1420 KB |
Output is correct |
2 |
Correct |
23 ms |
1496 KB |
Output is correct |
3 |
Correct |
46 ms |
1492 KB |
Output is correct |
4 |
Incorrect |
105 ms |
1712 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
308 ms |
1448 KB |
3rd lines differ - on the 3rd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
1492 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
81 ms |
1364 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |