# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296072 | Dovran | Toy Train (IOI17_train) | C++11 | 0 ms | 0 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>
#include "train.h"
#define N 20009
#define pii pair <int, int>
#define ff first
#define ss second
#define sz() size()
#define pb push_back
#define ll long long
using namespace std;
bool v[N];
vector<int>ans;
int who_wins(vector<int>o, vector<int>p, vector<int>u, vector<int>v){
int n=o.sz();
int m=u.sz();
vector<int>e[N];
int c[N];
for(int i=0; i<m; i++){
e[u[i]].pb(v[i]);
if(u[i]==v[i])
c[u[i]]=1;
}
for(int i=0; i<n; i++){
if(p[i] and o[i] and c[i])
v[i]=1;
v[i]+=v[i-1];
ans.pb(v[i]);
}
return ans;
}