#include "popa.h"
#include<bits/stdc++.h>
using namespace std;
int tole[1005],tori[1005];
int calc(int le, int ri)
{
if(le>ri)
return -1;
for(int root=le;root<=ri;root++)
{
if(query(root,root,le,ri))
{
tole[root] = calc(le,root-1);
tori[root] = calc(root+1,ri);
return root;
}
}
}
int solve(int N, int* Left, int* Right)
{
for(int i=0;i<N;i++)
tole[i]=tori[i]=-1;
int root = calc(0,N-1);
for(int i=0;i<N;i++)
{
Left[i]=tole[i];
Right[i]=tori[i];
}
return root;
}
Compilation message
popa.cpp: In function 'int calc(int, int)':
popa.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
18 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Output is correct |
2 |
Correct |
61 ms |
444 KB |
Output is correct |
3 |
Correct |
9 ms |
344 KB |
Output is correct |
4 |
Correct |
36 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
173 ms |
428 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
344 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |