# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1025798 | parsadox2 | Toy Train (IOI17_train) | C++17 | 14 ms | 860 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 N = 5e3 + 10;
bool charge[N] , self[N] , ty[N] , nex[N];
int n , m;
bool Solve(int v)
{
for(int i = v ; i < n ; i++)
{
if(!nex[i])
return charge[i];
if(!self[i])
continue;
if(!charge[i] && !ty[i])
return 0;
if(charge[i] && ty[i])
return 1;
}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
n = a.size() ; m = u.size();
vector<int> res(a.size());
for(int i = 0 ; i < n ; i++)
ty[i] = a[i];
for(int i = 0 ; i < n ; i++)
charge[i] = r[i];
for(int i = 0 ; i < m ; i++)
{
if(u[i] == v[i])
self[u[i]] = true;
else
nex[u[i]] = true;
}
for(int i = 0 ; i < n ; i++)
res[i] = Solve(i);
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... |