#include "train.h"
#include <bits/stdc++.h>
using ll = long long;
using std::vector;
using std::array;
using std::pair;
using std::tuple;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
const int n = a.size();
const int m = u.size();
vector<char> loop(n), next(n);
for (int i = 0; i < m; ++i) {
if (u[i] == v[i]) {
loop[u[i]] = true;
} else {
next[u[i]] = true;
}
}
vector<int> ret(n);
for (int i = n - 1; i >= 0; --i) {
if (a[i]) {
ret[i] = (loop[i] and r[i]) or (next[i] and ret[i + 1]);
} else {
ret[i] = !((loop[i] and !r[i]) or (next[i] and !ret[i + 1]));
}
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
596 KB |
Output is correct |
2 |
Correct |
3 ms |
596 KB |
Output is correct |
3 |
Correct |
3 ms |
568 KB |
Output is correct |
4 |
Correct |
3 ms |
692 KB |
Output is correct |
5 |
Correct |
3 ms |
600 KB |
Output is correct |
6 |
Correct |
4 ms |
596 KB |
Output is correct |
7 |
Correct |
4 ms |
568 KB |
Output is correct |
8 |
Correct |
3 ms |
600 KB |
Output is correct |
9 |
Correct |
5 ms |
568 KB |
Output is correct |
10 |
Correct |
3 ms |
468 KB |
Output is correct |
11 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
852 KB |
Output is correct |
2 |
Correct |
6 ms |
824 KB |
Output is correct |
3 |
Correct |
5 ms |
852 KB |
Output is correct |
4 |
Incorrect |
5 ms |
852 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
724 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
832 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
596 KB |
Output is correct |
2 |
Correct |
3 ms |
596 KB |
Output is correct |
3 |
Correct |
3 ms |
568 KB |
Output is correct |
4 |
Correct |
3 ms |
692 KB |
Output is correct |
5 |
Correct |
3 ms |
600 KB |
Output is correct |
6 |
Correct |
4 ms |
596 KB |
Output is correct |
7 |
Correct |
4 ms |
568 KB |
Output is correct |
8 |
Correct |
3 ms |
600 KB |
Output is correct |
9 |
Correct |
5 ms |
568 KB |
Output is correct |
10 |
Correct |
3 ms |
468 KB |
Output is correct |
11 |
Correct |
3 ms |
468 KB |
Output is correct |
12 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 |
Halted |
0 ms |
0 KB |
- |