제출 #106919

#제출 시각아이디문제언어결과실행 시간메모리
106919tjd229popa (BOI18_popa)C++14
61 / 100
196 ms472 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...