#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
const int N = 1005;
int n;
int dnc(int l, int r, int* lc, int* rc){
if (l > r) return -1;
int lo = l - 1, hi = r;
while (hi - lo > 1){
int mid = (lo + hi) / 2;
if (query(l, mid, l, r))
hi = mid;
else
lo = mid;
}
int root = hi;
lc[root] = dnc(l, root - 1, lc, rc);
rc[root] = dnc(root + 1, r, lc, rc);
return root;
}
int solve(int nn, int* Left, int* Right){
n = nn;
return dnc(0, n - 1, Left, Right);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |