Submission #59769

# Submission time Handle Problem Language Result Execution time Memory
59769 2018-07-23T05:18:44 Z model_code popa (BOI18_popa) C++17
37 / 100
371 ms 624 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;
	for (int i = l; i <= r; i++) {
		if (query(l, r, i, i)) {
			lf[i] = dfs(l, i - 1);
			rg[i] = dfs(i + 1, r);
			return i;
		}
	}
}

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;
}

Compilation message

popa.cpp: In function 'int dfs(int, int)':
popa.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 86 ms 420 KB Output is correct
2 Correct 129 ms 420 KB Output is correct
3 Correct 29 ms 420 KB Output is correct
4 Correct 74 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 504 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 624 KB too many queries
2 Halted 0 ms 0 KB -