# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
291000 |
2020-09-04T15:21:13 Z |
Saboon |
Toy Train (IOI17_train) |
C++17 |
|
9 ms |
896 KB |
// Subtask 1
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
int n, m;
bool loop[maxn], go[maxn];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
n = a.size(), m = u.size();
for (int i = 0; i < m; i++){
if (v[i] == u[i])
loop[u[i]] = true;
else
go[u[i]] = true;
}
vector<int> dp(n);
for (int i = n-1; i >= 0; i--){
if (loop[i] == 0){
dp[i] = dp[i+1];
continue;
}
if (go[i] == 0){
dp[i] = r[i];
continue;
}
if (a[i] == 0){
if (r[i])
dp[i] = dp[i+1];
else
dp[i] = 0;
}
else{
if (r[i])
dp[i] = 1;
else
dp[i] = dp[i+1];
}
}
return dp;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Correct |
4 ms |
640 KB |
Output is correct |
3 |
Correct |
6 ms |
640 KB |
Output is correct |
4 |
Correct |
4 ms |
640 KB |
Output is correct |
5 |
Correct |
6 ms |
640 KB |
Output is correct |
6 |
Correct |
4 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
668 KB |
Output is correct |
8 |
Correct |
6 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
640 KB |
Output is correct |
10 |
Correct |
4 ms |
640 KB |
Output is correct |
11 |
Correct |
4 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 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 |
7 ms |
896 KB |
Output is correct |
2 |
Correct |
7 ms |
896 KB |
Output is correct |
3 |
Correct |
7 ms |
896 KB |
Output is correct |
4 |
Incorrect |
7 ms |
896 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 |
9 ms |
768 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 |
8 ms |
896 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 |
640 KB |
Output is correct |
2 |
Correct |
4 ms |
640 KB |
Output is correct |
3 |
Correct |
6 ms |
640 KB |
Output is correct |
4 |
Correct |
4 ms |
640 KB |
Output is correct |
5 |
Correct |
6 ms |
640 KB |
Output is correct |
6 |
Correct |
4 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
668 KB |
Output is correct |
8 |
Correct |
6 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
640 KB |
Output is correct |
10 |
Correct |
4 ms |
640 KB |
Output is correct |
11 |
Correct |
4 ms |
512 KB |
Output is correct |
12 |
Incorrect |
1 ms |
256 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 |
Halted |
0 ms |
0 KB |
- |