#include<bits/stdc++.h>
#include "train.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;int n,m;
vector<int>ans;
const int N=5090;
int vis[N];
vector<int>v[N];
int r[N];
int dfs(int x)
{
if(v[x][0]==x)
{
if(r[x])return 1;
return 0;
}
if(v[x].size()==0)return 0;
return dfs(v[x][0]);
}
vector<int> who_wins(vector<int> A,vector<int> R,vector<int> u,vector<int> uu) {
n=R.size();m=u.size();
for(int i=0;i<n;i++)
r[i]=R[i];
for(int i=0;i<m;i++)
v[u[i]].pb(uu[i]);
for(int i=0;i<n;i++)
{
ans.pb(dfs(i));
}
return ans;
}
/*
4 4
0 0 0 0
0 0 0 1
0 1
1 2
2 2
3 3
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
716 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 |
Execution timed out |
2049 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
1092 KB |
Output is correct |
2 |
Correct |
85 ms |
1096 KB |
Output is correct |
3 |
Correct |
87 ms |
1000 KB |
Output is correct |
4 |
Execution timed out |
2096 ms |
972 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2029 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2071 ms |
972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
716 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |