#include<bits/stdc++.h>
using namespace std;
#include "train.h"
vector<vector<int>> adj;
vector<bool> v;
vector<int> res;
vector<int> a, r;
bool dfs(int node){
if(v[node]) {
return r[node];
}
v[node] = 1;
if(r[node]) return r[node];
for(auto e : adj[node]){
if(dfs(e)){
return 1;
}
}
return 0;
}
std::vector<int> who_wins(std::vector<int> ta, std::vector<int> tr, std::vector<int> u, std::vector<int> tv) {
int N = ta.size();
int M = u.size();
adj = vector<vector<int>> (N);
res = vector<int> (N);
a = ta;
r = tr;
for(int i = 0; i < M; i++) {
adj[u[i]].push_back(tv[i]);
}
for(int i = 0; i < N; i++){
v = vector<bool> (N);
res[i] = dfs(i);
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
896 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
93 ms |
1536 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1152 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
1280 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
896 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |