# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137226 | MAMBA | Toy Train (IOI17_train) | C++17 | 11 ms | 1144 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 , j ,k) for(int i = j; i < (int)k; i++)
#define pb push_back
typedef vector<int> vi;
const int N = 5010;
vi adj[N];
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();
rep(i , 0 , m)
adj[u[i]].pb(v[i]);
bool Bo = false;
bool Ar = false;
rep(i , 0 , n) {
if (a[i]) Ar = true;
else Bo = true;
}
if (Bo == false) {
;
}
vi res(n);
for (int i = n - 1; ~i; i--) {
bool A = false;
bool B = false;
for (auto e : adj[i]) {
if (i == e) {
if (r[i])
A = true;
else
B = true;
}
else {
if (res[e])
A = true;
else
B = true;
}
}
if (a[i] && A) res[i] = true;
if (!a[i] && !B) res[i] = true;
}
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... |