Submission #59770

# Submission time Handle Problem Language Result Execution time Memory
59770 2018-07-23T05:19:16 Z model_code popa (BOI18_popa) C++17
61 / 100
481 ms 672 KB
#include <bits/stdc++.h>
#include "popa.h"

using namespace std;

const int MaxN = 1010;

int lf[MaxN], rg[MaxN];

int dfs(int l, int r) {
	if (l > r) return -1;
	int st = l, dr = r;
	while (st <= dr) {
		int mid = (st + dr) / 2;
		if (query(l, r, l, mid)) dr = mid - 1;
		else st = mid + 1;
	}
	lf[st] = dfs(l, st - 1);
	rg[st] = dfs(st + 1, r);
	return st;
}

int solve(int n, int* left, int* right) {
	int root = dfs(0, n - 1);
	for (int i = 0; i < n; i++) {
		left[i] = lf[i];
		right[i] = rg[i];
	}
	return root;
}
# Verdict Execution time Memory Grader output
1 Correct 35 ms 252 KB Output is correct
2 Correct 42 ms 344 KB Output is correct
3 Correct 16 ms 472 KB Output is correct
4 Correct 27 ms 552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 672 KB Output is correct
2 Correct 481 ms 672 KB Output is correct
3 Correct 95 ms 672 KB Output is correct
4 Correct 309 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 672 KB too many queries
2 Halted 0 ms 0 KB -