#include "train.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
std::vector<int> who_wins(std::vector<int> aowns, std::vector<int> charging, std::vector<int> u, std::vector<int> v) {
n=aowns.size();
m=u.size();
vector<bool> iscycle(n);
for (int i = 0; i<m; i++){
if (u[i]==v[i]){
iscycle[u[i]]=true;
}
}
vector<int> ans(n);
for (int i = n-1; i>=0; i--){
if (iscycle[i]){
if (aowns[i]&&charging[i]){
ans[i]=1;
} else if ((!aowns[i])&&(!charging[i])){
ans[i]=0;
} else {
ans[i]=ans[i+1];
}
} else {
ans[i]=ans[i+1];
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Incorrect |
4 ms |
640 KB |
3rd lines differ - on the 4997th token, expected: '1', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
6 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 |
7 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 |
Incorrect |
4 ms |
640 KB |
3rd lines differ - on the 4997th token, expected: '1', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |