#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int rl[1005], rr[1005];
int recur(int s, int e, int p) {
if (s > e) return -1;
int r = s;
for (int i = s + 1; i <= e; i++) {
if (query(s, i, i, e) == 0) continue;
r = i;
break;
}
rl[r] = recur(s, r - 1, r);
rr[r] = recur(r + 1, e, r);
return r;
}
int solve(int N, int*l, int *r) {
memset(rl, -1, sizeof(rl));
memset(rr, -1, sizeof(rr));
int root = recur(0, N - 1, -1);
for (int i = 0; i < N; i++) {
l[i] = rl[i];
r[i] = rr[i];
}
return root;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
208 KB |
Output is correct |
2 |
Correct |
162 ms |
208 KB |
Output is correct |
3 |
Correct |
19 ms |
208 KB |
Output is correct |
4 |
Correct |
150 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
296 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
208 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |