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"
using namespace std;
vector<int>who_wins(vector<int>a, vector<int>r, vector<int>u, vector<int>v) {
int n = r.size();
int m = u.size();
vector<bool>self(n,0);
vector<bool>nx(n,0);
for(int i = 0 ; i < m ; i++) {
if(v[i] == u[i])
self[v[i]] = 1;
else
nx[u[i]] = 1;
}
vector<int>ans(n,0);
for(int i = n-1 ; i >= 0 ; i--) {
if(a[i]) {
if(nx[i] && ans[i+1])
ans[i] = 1;
if(self[i] && r[i])
ans[i] = 1;
} else {
if(nx[i] && ans[i+1]) {
if(!self[i])
ans[i] = 1;
if(self[i] && r[i])
ans[i] = 1;
} else {
if(!nx[i] && r[i])
ans[i] = 1;
}
}
}
return ans;
}
# | 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... |