# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
424924 |
2021-06-12T11:40:47 Z |
rainboy |
Toy Train (IOI17_train) |
C++17 |
|
47 ms |
924 KB |
#include "train.h"
#include <string.h>
using namespace std;
const int N = 5000, M = 20000;
typedef vector<int> vi;
char self[N], right[N];
vi who_wins(vi aa, vi rr, vi uu, vi vv) {
int n = aa.size(), m = uu.size(), h, i, j;
vi ans(n);
memset(self, 0, n * sizeof *self), memset(right, 0, n * sizeof *right);
for (h = 0; h < m; h++)
if (vv[h] == uu[h])
self[uu[h]] = 1;
else
right[uu[h]] = 1;
for (i = 0; i < n; i++) {
ans[i] = 0;
for (j = i; j < n; j++)
if (aa[j]) {
if (rr[j]) {
if (self[j]) {
ans[i] = 1;
break;
}
} else {
if (!right[j]) {
ans[i] = 0;
break;
}
}
} else {
if (rr[j]) {
if (!right[j]) {
ans[i] = 1;
break;
}
} else {
if (self[j]) {
ans[i] = 0;
break;
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
5 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
456 KB |
Output is correct |
6 |
Correct |
4 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
3 ms |
460 KB |
Output is correct |
9 |
Correct |
3 ms |
460 KB |
Output is correct |
10 |
Correct |
3 ms |
460 KB |
Output is correct |
11 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
924 KB |
Output is correct |
2 |
Correct |
33 ms |
888 KB |
Output is correct |
3 |
Correct |
36 ms |
888 KB |
Output is correct |
4 |
Incorrect |
47 ms |
844 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
760 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
796 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
5 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
456 KB |
Output is correct |
6 |
Correct |
4 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
3 ms |
460 KB |
Output is correct |
9 |
Correct |
3 ms |
460 KB |
Output is correct |
10 |
Correct |
3 ms |
460 KB |
Output is correct |
11 |
Correct |
3 ms |
460 KB |
Output is correct |
12 |
Incorrect |
0 ms |
204 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 |
Halted |
0 ms |
0 KB |
- |