# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
122553 | SirCeness | Toy Train (IOI17_train) | C++14 | 11 ms | 2816 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 <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
list<int> adj[50004];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
for (int i = 0; i < u.size(); i++){
adj[u[i]].pb(v[i]);
}
vector<int> ans(a.size());
for (int i = a.size()-1; i >= 0; i--){
int kendine = 0;
int ileri = 0;
for (list<int>::iterator it = adj[i].begin(); it != adj[i].end(); ++it){
if (*it == i) kendine = 1;
if (*it == i+1) ileri = 1;
}
if (kendine){
if (a[i] == 1 && r[i] == 1){
ans[i] = 1;
continue;
} else if (a[i] == 0 && r[i] == 0){
ans[i] = 0;
continue;
}
}
if (!ileri){
if (r[i] == 0) ans[i] = 0;
else if (r[i] == 1) ans[i] = 1;
break;
} else {
assert(i+1 != ans.size());
ans[i] = ans[i+1];
}
}
return ans;
}
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... |