求调
查看原帖
求调
587959
ydkxj楼主2024/4/12 20:56
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cctype>
#include <string>
using namespace std;
#define int long long
const int inf=1e9;
const int N=505;
int pos,v,l[N],r[N],tot,lt,rt;
int check(int l, int r) {
	cout<<"check "<<l<<" "<<r<<"\n";
  	string res; 
  	cin>>res;
  	if (res[0]=='Y') return 1;
  	else return 0;
}
signed main() {
  	ios::sync_with_stdio(0);
  	cin.tie(0);
	cout.tie(0);
	cin>>pos>>rt;
	int le=0,ri=pos;
  	while(le<ri) {
    	int mid=(le+ri)/2;
    	if(check(le,mid)==1)ri=mid;
    	else le=mid+1;
    	for(int i=1;i<=tot;i++) {
      		lt=max(lt,(le-r[i])/(tot+1-i));
      		rt=min(rt,(ri-l[i])/(tot+1 -i));
    	}
    	tot++;
    	l[tot]=le;
		r[tot]=ri;
    	le+=lt;
    	ri+=rt;
  	}
  	cout<<"answer "<<left<<"\n";
  return 0;
}
2024/4/12 20:56
加载中...