#include "train.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> ke[5001],ke2[5001],ke3[5001],d,A,R;
int n,m,vis[5001],p[5001],sz[5001],ch[5001];
stack <int> st;
queue <int> q;
int f(int u){
if (d[u]!=-1)
return d[u];
if (A[u]){
if (ch[u]&&R[u])
return d[u]=1;
return d[u]=f(ke[u][0]);
}
if (ch[u]&&!R[u])
return d[u]=0;
return d[u]=f(ke[u][0]);
}
vector <int> who_wins(vector <int> a, vector <int> r, vector <int> u, vector <int> v){
A=a,R=r,n=a.size(),m=u.size();
for (int i=0;i<m;i++){
if (u[i]==v[i])
ch[u[i]]=1;
ke3[v[i]].push_back(u[i]);
ke[u[i]].push_back(v[i]);
ke2[v[i]].push_back(u[i]);
}
d.assign(n,-1);
for (int i=0;i<n;i++)
d[i]=f(i);
return d;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
233 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
205 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
207 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
218 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
226 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
233 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |