This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
popa.cpp: In function 'int resi(int, int, int*, int*)':
popa.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |