# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037511 | sleepntsheep | Toy Train (IOI17_train) | C++17 | 4 ms | 980 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"
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n = a.size();
int m = u.size();
std::vector<int> loop(n);
for (int i = 0; i < m; ++i)
if (u[i] == v[i])
loop[u[i]] = 1;
std::vector<int> res(a.size());
int are = 0, bre = 0;
if (r[n-1])
res[n-1] = 1, are = 1;
else
bre = 1;
for (int i = n - 2; i >= 0; --i) {
if (loop[i]) {
if (r[i]) {
res[i] = 1;
} else {
res[i] = 0;
}
} else {
res[i] = 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... |