#include<bits/stdc++.h>
#include "train.h"
using namespace std;
#define pb push_back
int vis[5005]={0};
vector<int> answer;
vector<int> G[5005];
int charge[5005]={0};
int flag=0;
int flag2=0;
void dfs(int node,int start){
vis[node]=1;
if(charge[node]) flag=1;
for(int i:G[node]){
if(i==start) flag2=1;
if(!vis[i]) dfs(i,start);
}
}
vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v){
for(int i=0;i<(int)r.size();i++){
charge[i]=r[i];
}
for(int i=0;i<(int)u.size();i++){
G[u[i]].push_back(v[i]);
}
for(int i=0;i<(int)a.size();i++){
flag2=0;
for(int j=0;j<(int)a.size();j++){
vis[j]=0;
}
if(charge[i]) dfs(i,i);
if(!flag2) charge[i]=0;
}
for(int i=0;i<(int)a.size();i++){
flag=0;
for(int j=0;j<(int)a.size();j++){
vis[j]=0;
}
dfs(i,0);
if(flag) answer.pb(1);
else answer.pb(0);
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
270 ms |
1144 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 |
340 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 |
128 ms |
1280 KB |
Output is correct |
2 |
Correct |
149 ms |
1464 KB |
Output is correct |
3 |
Correct |
154 ms |
1536 KB |
Output is correct |
4 |
Correct |
1076 ms |
1432 KB |
Output is correct |
5 |
Correct |
695 ms |
1484 KB |
Output is correct |
6 |
Correct |
503 ms |
1432 KB |
Output is correct |
7 |
Correct |
606 ms |
1240 KB |
Output is correct |
8 |
Correct |
241 ms |
1540 KB |
Output is correct |
9 |
Correct |
232 ms |
1356 KB |
Output is correct |
10 |
Correct |
311 ms |
1216 KB |
Output is correct |
11 |
Correct |
257 ms |
1236 KB |
Output is correct |
12 |
Correct |
28 ms |
1196 KB |
Output is correct |
13 |
Correct |
875 ms |
1412 KB |
Output is correct |
14 |
Correct |
915 ms |
1364 KB |
Output is correct |
15 |
Correct |
890 ms |
1452 KB |
Output is correct |
16 |
Correct |
886 ms |
1452 KB |
Output is correct |
17 |
Correct |
877 ms |
1424 KB |
Output is correct |
18 |
Correct |
377 ms |
1276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1300 ms |
1076 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 |
897 ms |
1180 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 |
270 ms |
1144 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |