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 F first
#define S second
#define pii pair<int, int>
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxN = 5e3 + 10;
bool nex[maxN], tog[maxN];
bool w[maxN];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n = a.size(), m = u.size();
for (int i=0; i<m; i++)
{
if(u[i] == v[i]) tog[u[i]] = true;
else if(u[i] + 1 == v[i]) nex[u[i]] = true;
}
for (int i=n-1; i>=0; i--)
{
if(a[i])
{
if(r[i] && tog[i]) w[i] = true;
else if(nex[i]) w[i] = w[i + 1];
else w[i] = false;
}else
{
if(!r[i] && tog[i]) w[i] = false;
else if(nex[i]) w[i] = w[i + 1];
else w[i] = true;
}
}
vector <int> ans;
for (int i=0; i<n; i++) ans.pb(w[i]);
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... |