# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
283074 | MKopchev | Toy Train (IOI17_train) | C++14 | 15 ms | 1920 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;
const int nmax=1e6+42;
set< pair<int,int> > edges;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<u.size();i++)
edges.insert({u[i],v[i]});
vector<int> win(a.size(),0);
for(int i=a.size()-1;i>=0;i--)
{
if(edges.count({i,i})==0)win[i]=win[i+1];
else if(edges.count({i,i+1})==0)win[i]=r[i];
else
{
if(a[i]==1)
{
if(r[i]==1)win[i]=1;
else win[i]=win[i+1];
}
else
{
if(r[i]==0)win[i]=0;
else win[i]=win[i+1];
}
}
}
return win;
}
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... |