#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int find_root(int l, int r)
{
for (int i = l; i <= r; i++)
if (query(i, i, l, r))
return i;
}
int f(int l, int r, int *left, int *right)
{
if (l > r)
return -1;
int root = find_root(l, r);
left[root] = f(l, root-1, left, right);
right[root] = f(root+1, r, left, right);
return root;
}
int solve(int n, int *left, int *right)
{
return f(0, n-1, left, right);
}
Compilation message
popa.cpp: In function 'int find_root(int, int)':
popa.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
11 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
71 ms |
364 KB |
Output is correct |
2 |
Correct |
85 ms |
364 KB |
Output is correct |
3 |
Correct |
22 ms |
364 KB |
Output is correct |
4 |
Correct |
79 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
196 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
364 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |