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 <string.h>
using namespace std;
const int N = 5000, M = 20000;
typedef vector<int> vi;
char self[N], right[N];
vi who_wins(vi aa, vi rr, vi uu, vi vv) {
int n = aa.size(), m = uu.size(), h, i, j;
vi ans(n);
memset(self, 0, n * sizeof *self), memset(right, 0, n * sizeof *right);
for (h = 0; h < m; h++)
if (vv[h] == uu[h])
self[uu[h]] = 1;
else
right[uu[h]] = 1;
for (i = 0; i < n; i++) {
ans[i] = 0;
for (j = i; j < n; j++)
if (aa[j]) {
if (rr[j]) {
if (self[j]) {
ans[i] = 1;
break;
}
} else {
if (!right[j]) {
ans[i] = 0;
break;
}
}
} else {
if (rr[j]) {
if (!right[j]) {
ans[i] = 1;
break;
}
} else {
if (self[j]) {
ans[i] = 0;
break;
}
}
}
}
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... |