就是三次二分
#include<bits/stdc++.h>
#define wr cout<<'W';
#define jud cout<<l<<' '<<r<<' '<<m<<endl;
using namespace std;
int Query(int x);
void init(){}
pair<int,int> Guess(int n,int c){
int l,r,m,mid,res;
int a,b;
l=1,r=n;
while(l<=r){
m=(l+r)>>1;
res=Query(m);
if(res<=0){
l=m+1;
}
else if(res>0){
r=m-1;
}
}
m=(l+r)>>1;
l=1,r=m-1;
while(l<=r){
mid=(l+r)>>1;
res=Query(mid);
if(res<0){
l=mid+1;
}
else if(res>=0){
r=mid-1;
}
}
a=l;
l=m+1,r=n;
while(l<=r){
mid=(l+r)>>1;
res=Query(mid);
if(res<=0){
l=mid+1;
}
else if(res>0){
r=mid-1;
}
}
b=r;
return make_pair(a,b);
}
求正解qwq