#include "train.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
const int mxN = (int)5e3+10;
vi adj[mxN];
vi who_wins(vi a, vi r, vi u, vi v) {
int n = sz(a), m = sz(u); vi ans(n,0);
for(int i = 0; i < m; i++) adj[u[i]].pb(v[i]);
for(int i = 0; i < n; i++) sort(all(adj[i]));
for(int i = 0; i < n; i++){
if(adj[i][0]==i and r[i]){
if(a[i] or sz(adj[i])==1){ ans[i] = 1;
for(int j = i-1; j >= 0; j--){
if(sz(adj[j])==2 or adj[i][0]==i) break;
ans[j] = 1;
}
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
816 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
424 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
1236 KB |
Output is correct |
2 |
Correct |
5 ms |
1172 KB |
Output is correct |
3 |
Correct |
5 ms |
1236 KB |
Output is correct |
4 |
Incorrect |
6 ms |
1236 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
964 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
1228 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
816 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |