# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
617911 | Ozy | Toy Train (IOI17_train) | C++17 | 8 ms | 1364 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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "
#define MAX 5000
lli n,m;
vector<lli> hijos[MAX];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
m = u.size();
rep(i,0,m-1) hijos[u[i]].push_back(v[i]);
n = a.size();
vector<int> res;
res.resize(n);
rep(i,0,n-1) res[i] = a[i]^1;
repa(i,n-1,0) {
if (a[i] == 1) {
for (auto h : hijos[i]) {
if (h == i && r[i] == 1) res[i] = 1;
else if (res[h] == 1) res[i] == 1;
}
}
else {
for (auto h : hijos[i]) {
if (h == i && r[i] == 0) res[i] = 0;
else if (res[h] == 0) res[i] == 0;
}
}
}
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... |