# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
646185 |
2022-09-29T05:01:23 Z |
jamezzz |
Toy Train (IOI17_train) |
C++17 |
|
313 ms |
1748 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();
for(int v:RAL[u]){
if(ans[v])continue;
ans[v]=true;
q.push(v);
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
82 ms |
1304 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 |
1 ms |
544 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 |
10 ms |
1676 KB |
Output is correct |
2 |
Correct |
22 ms |
1620 KB |
Output is correct |
3 |
Correct |
42 ms |
1656 KB |
Output is correct |
4 |
Correct |
123 ms |
1620 KB |
Output is correct |
5 |
Correct |
23 ms |
1656 KB |
Output is correct |
6 |
Correct |
59 ms |
1588 KB |
Output is correct |
7 |
Correct |
160 ms |
1556 KB |
Output is correct |
8 |
Correct |
7 ms |
1576 KB |
Output is correct |
9 |
Correct |
7 ms |
1492 KB |
Output is correct |
10 |
Correct |
9 ms |
1456 KB |
Output is correct |
11 |
Correct |
8 ms |
1480 KB |
Output is correct |
12 |
Correct |
7 ms |
1468 KB |
Output is correct |
13 |
Correct |
8 ms |
1620 KB |
Output is correct |
14 |
Correct |
8 ms |
1620 KB |
Output is correct |
15 |
Correct |
8 ms |
1748 KB |
Output is correct |
16 |
Correct |
8 ms |
1492 KB |
Output is correct |
17 |
Correct |
8 ms |
1620 KB |
Output is correct |
18 |
Correct |
130 ms |
1372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
313 ms |
1484 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 |
8 ms |
1588 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 |
82 ms |
1304 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |