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 "popa.h"
int P[1000];
int solve(int N, int* L, int* R) {
int root = -1;
for (int i = 0; i < N; i++) {
L[i] = R[i] = P[i] = -1;
int par = i - 1;
while (par != -1 && query(i, i, par, i)) {
R[par] = L[i];
P[L[i]] = par;
L[i] = par;
int parpar = P[par];
P[par] = i;
par = parpar;
}
if (par == -1) {
L[i] = root;
if (root != -1) P[root] = i;
root = i;
} else {
R[par] = i;
P[i] = par;
}
}
return root;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |