#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
const int maxn = 1e3+10;
int n;
int L[maxn], R[maxn];
int root;
bool mark[maxn];
int f(int l, int r)
{
if (l > r) return -1;
for (int i = 0; i < n; i++)
{
if (!mark[i] && query(l, r, i, i))
{
if (l == 0 && r == n-1) root = i;
mark[i] = 1;
L[i] = f(l, i-1);
R[i] = f(i+1, r);
return i;
}
}
}
int solve(int N, int *Left, int *Right)
{
memset(mark, 0, sizeof mark);
n = N;
f(0, n-1);
for (int i = 0; i < n; i++)
Left[i] = L[i], Right[i] = R[i];
return root;
}
Compilation message
popa.cpp: In function 'int f(int, int)':
popa.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
32 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
376 KB |
Output is correct |
2 |
Correct |
104 ms |
256 KB |
Output is correct |
3 |
Correct |
20 ms |
384 KB |
Output is correct |
4 |
Correct |
80 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
293 ms |
376 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |