이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "popa.h"
int dfs(int l,int r,int *Left,int *Right) {
//degenerate case
if (l > r) return -1;
else if (l == r) {
Left[l] = Right[l] = -1;
return l;
}
int s = l, e = r;
int root = -1;
while (l <= r) {
int m = (l + r) >> 1;
if (query(s, e, l, m)) root=m,r = m - 1;
else l = m + 1;
}
//root chk
Left[root] = dfs(s, root - 1, Left, Right);
Right[root] = dfs(root+1,e, Left, Right);
return root;
}
int solve(int N, int *Left, int *Right) {
return dfs(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... |