题意:
解法:
最多30个点,log(1e9)大概也是30个点,
我们先取(0,1),记录颜色,
然后在[0,1e9]上二分mid,如果mid颜色和(0,1)一样,那么归到左边,
否则归到右边.
code:
#include <bits/stdc++.h>
using namespace std;
const int maxm=2e3+5;
int n;
void solve(){
cin>>n;
cout<<0<<' '<<1<<endl;
string lc;cin>>lc;
int l=0,r=1e9;
for(int i=1;i<=n-1;i++){
int mid=(l+r)/2;
cout<<mid<<' '<<1<<endl;
string s;cin>>s;
if(s==lc)l=mid;//颜色和lc一样,那么归到左边
else r=mid;//否则归到右边
}
//(l,1)和(r,1)上可能有点,因此我们选(l,0)和(r,2)
cout<<l<<' '<<0<<' '<<r<<' '<<2<<endl;
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
solve();
return 0;
}