# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
966662 |
2024-04-20T07:52:28 Z |
Amr |
Toy Train (IOI17_train) |
C++17 |
|
5 ms |
860 KB |
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz size()
#define F first
#define S second
const int N = 1e5+2;
ll same[N], to[N];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
ll n = a.sz;
ll m = u.sz;
vector<int> ans(n);
for(int i = 0; i < m; i++)
{
ll x = u[i] , y = v[i];
if(x==y) same[x] = 1;
if(y==x+1) to[x] = 1;
}
for(int i = n-1; i >= 0; i--)
{
if(a[i]==1){
if(same[i]&&r[i]) ans[i] = 1;
else if(to[i]) ans[i] = ans[i+1];
}
else
{
if(same[i]&&r[i]==0) ans[i] = 0;
else if(to[i]) ans[i] = ans[i+1];
else ans[i] = 1;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
612 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
604 KB |
Output is correct |
9 |
Correct |
2 ms |
616 KB |
Output is correct |
10 |
Correct |
2 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
860 KB |
Output is correct |
2 |
Correct |
5 ms |
860 KB |
Output is correct |
3 |
Correct |
5 ms |
860 KB |
Output is correct |
4 |
Incorrect |
4 ms |
860 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 |
4 ms |
860 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
860 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
612 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
604 KB |
Output is correct |
9 |
Correct |
2 ms |
616 KB |
Output is correct |
10 |
Correct |
2 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
13 |
Halted |
0 ms |
0 KB |
- |