# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783447 | boyliguanhan | Toy Train (IOI17_train) | C++17 | 4 ms | 856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
std::vector<int> res(a.size(),0);
res.back() = r.back();
int x[r.size()];
memset(x, 0, sizeof x);
for(int i = 0; i < u.size(); i++) {
x[u[i]]+=1<<v[i]-u[i];
}
for(int i = a.size()-1; i--;) {
if(a[i]) {
if(x[i]%2&&r[i]) res[i] = 1;
else if(x[i]>1&&res[i+1]) res[i] = 1;
} else {
if(x[i]%2&&!r[i]) res[i] = 0;
else if(x[i]>1&&!res[i+1])res[i] = 0;
else res[i] = 1;
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |