#include <bits/stdc++.h>
#include "popa.h"
#define maxN 1005
using namespace std;
int resi(int x,int y,int* l,int* d){
if(x>y) return -1;
if(x==y) return x;
int a,b;
a=x;
b=y;
while(a<=b){
if(query(x,y,a,a)){
l[a]=resi(x,a-1,l,d);
d[a]=resi(a+1,y,l,d);
return a;
}
if(query(x,y,b,b)){
l[b]=resi(x,b-1,l,d);
d[b]=resi(b+1,y,l,d);
return b;
}
a++;
b--;
}
}
int solve(int n, int* l, int* d){
for(int i=0;i<n;i++) l[i]=d[i]=-1;
return resi(0,n-1,l,d);
}
Compilation message
popa.cpp: In function 'int resi(int, int, int*, int*)':
popa.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
316 KB |
Output is correct |
2 |
Correct |
12 ms |
248 KB |
Output is correct |
3 |
Correct |
23 ms |
376 KB |
Output is correct |
4 |
Correct |
15 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
134 ms |
324 KB |
Output is correct |
2 |
Correct |
107 ms |
372 KB |
Output is correct |
3 |
Correct |
150 ms |
376 KB |
Output is correct |
4 |
Correct |
206 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
376 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |