#include "train.h"
//Challenge: Accepted
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define ll long long
#define maxn 5005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int dp[1<<16][16], adj[maxn][maxn];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n = a.size(), m = u.size();
for (int i = 0;i < m;i++) {
adj[u[i]][v[i]] = 1;
}
vector<int> ret;
for (int i = 0;i < n;i++) {
int cur = i;
bool res = 0;
while (true) {
if (a[cur] == 1) {
if (r[cur] == 1 && adj[cur][cur]) {
res = 1;
break;
} else if (adj[cur][cur + 1]){
cur++;
} else {
res = 0;
break;
}
} else {
if (r[cur] == 0 && adj[cur][cur]) {
res = 0;
break;
} else if (adj[cur][cur + 1]) {
cur++;
} else {
res = 1;
break;
}
}
}
ret.push_back(res ? 1 : 0);
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
20692 KB |
Output is correct |
2 |
Correct |
13 ms |
20736 KB |
Output is correct |
3 |
Correct |
13 ms |
20732 KB |
Output is correct |
4 |
Correct |
13 ms |
20816 KB |
Output is correct |
5 |
Correct |
13 ms |
20812 KB |
Output is correct |
6 |
Correct |
13 ms |
20788 KB |
Output is correct |
7 |
Correct |
13 ms |
20712 KB |
Output is correct |
8 |
Correct |
12 ms |
20696 KB |
Output is correct |
9 |
Correct |
12 ms |
20684 KB |
Output is correct |
10 |
Correct |
12 ms |
20788 KB |
Output is correct |
11 |
Correct |
12 ms |
20764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
26840 KB |
Output is correct |
2 |
Correct |
21 ms |
29996 KB |
Output is correct |
3 |
Correct |
21 ms |
32892 KB |
Output is correct |
4 |
Incorrect |
30 ms |
56472 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
46652 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
55940 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
20692 KB |
Output is correct |
2 |
Correct |
13 ms |
20736 KB |
Output is correct |
3 |
Correct |
13 ms |
20732 KB |
Output is correct |
4 |
Correct |
13 ms |
20816 KB |
Output is correct |
5 |
Correct |
13 ms |
20812 KB |
Output is correct |
6 |
Correct |
13 ms |
20788 KB |
Output is correct |
7 |
Correct |
13 ms |
20712 KB |
Output is correct |
8 |
Correct |
12 ms |
20696 KB |
Output is correct |
9 |
Correct |
12 ms |
20684 KB |
Output is correct |
10 |
Correct |
12 ms |
20788 KB |
Output is correct |
11 |
Correct |
12 ms |
20764 KB |
Output is correct |
12 |
Incorrect |
1 ms |
332 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
13 |
Halted |
0 ms |
0 KB |
- |