#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
int path[N][N];
bool special[N];
vector<int> adj[N];
void dfs(int v,int num){
path[num][v] = 1;
for(auto u:adj[v]){
if(!path[num][u]){
dfs(u,num);
}
}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size();
int m = u.size();
for(int i=0;i<m;i++){
adj[u[i]].push_back(v[i]);
}
for(int i = 0;i<n;i++){
dfs(i,i);
}
for(int i = 0;i<n;i++){
if(r[i]){
for(auto u:adj[i]){
if(path[u][i]){
special[i] = 1;
}
}
}
}
vector<int> res(n);
for(int i = 0; i < n; i++){
for(int j = 0;j<n;j++){
if(special[j] && path[i][j]){
res[i] = 1;
}
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
254 ms |
68024 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
428 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
195 ms |
99196 KB |
Output is correct |
2 |
Correct |
185 ms |
99216 KB |
Output is correct |
3 |
Correct |
216 ms |
99164 KB |
Output is correct |
4 |
Correct |
1006 ms |
99272 KB |
Output is correct |
5 |
Correct |
773 ms |
99288 KB |
Output is correct |
6 |
Correct |
536 ms |
99204 KB |
Output is correct |
7 |
Correct |
657 ms |
99056 KB |
Output is correct |
8 |
Correct |
333 ms |
99248 KB |
Output is correct |
9 |
Correct |
328 ms |
99176 KB |
Output is correct |
10 |
Correct |
458 ms |
99124 KB |
Output is correct |
11 |
Correct |
362 ms |
98892 KB |
Output is correct |
12 |
Correct |
88 ms |
83608 KB |
Output is correct |
13 |
Correct |
958 ms |
99236 KB |
Output is correct |
14 |
Correct |
939 ms |
99248 KB |
Output is correct |
15 |
Correct |
935 ms |
99164 KB |
Output is correct |
16 |
Correct |
935 ms |
99328 KB |
Output is correct |
17 |
Correct |
950 ms |
99284 KB |
Output is correct |
18 |
Correct |
303 ms |
98900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
814 ms |
99100 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
981 ms |
99208 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
254 ms |
68024 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |