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>
using namespace std;
#define for2(a,b,c) for(int a=b;a<c;a++)
#define ll long long
#include "train.h"
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
std::vector<int> res(a.size());
int n = a.size();
int m = u.size();
vector<bool> nxt(n);
vector<bool> loop(n);
for2(i,0,m){
if(u[i] == v[i]) loop[v[i]] = 1;
else nxt[u[i]] = 1;
}
for(int i = n-1; i >= 0; i--){
if(r[i]){
if(a[i]){
if(loop[i]) res[i] = 1;
else if(i!=n-1) res[i] = res[i+1];
}else{
if(nxt[i]) res[i] = res[i+1];
else res[i] = 1;
}
}else{
if(a[i]){
if(nxt[i]) res[i] = res[i+1];
else res[i] = 0;
}else{
if(loop[i]) res[i] = 0;
else res[i] = res[i+1];
}
}
}
return res;
}
# | 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... |