#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;
void dfs(int node){
vis[node]=1;
if(charge[node]) flag=1;
for(int i:G[node]){
if(!vis[i]) dfs(i);
}
}
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++){
flag=0;
for(int j=0;j<(int)a.size();j++){
vis[j]=0;
}
dfs(i);
if(flag) answer.pb(1);
else answer.pb(0);
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
166 ms |
1032 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 |
420 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 |
130 ms |
1368 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 |
680 ms |
1304 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 |
833 ms |
1368 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 |
166 ms |
1032 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |