#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]
}
^
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
371 ms |
504 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
624 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |