# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068243 | edogawa_something | Toy Train (IOI17_train) | C++17 | 7 ms | 1628 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;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
vii adj[5001],radj[5001];
vector<int>a,r,answer;
ll dfs(ll x) {
if(adj[x].size()==1) {
if(adj[x][0]==x)
return r[x];
else
return dfs(x+1);
}
if(!(a[x]^r[x]))
return dfs(x+1);
return a[x];
}
vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) {
a=A,r=R;
for(int i=0;i<u.size();i++)
adj[u[i]].pb(v[i]);
for(int i=0;i<a.size();i++) {
answer.pb(dfs(i));
}
return answer;
}
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... |