这份二分代码神奇爆蛋,调了 1h 还是没发现哪里错了/ll求调
//QwQcOrZ yyds!!!
#include<bits/stdc++.h>
#define ll long long
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define R(i,a,b) for (int i=(a);i<(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,x) for (int i=head[x];i;i=e[i].nx)
#define mp make_pair
#define pb push_back
#define pa pair < int,int >
#define fi first
#define se second
#define re register
#define be begin()
#define en end()
#define sqr(x) ((x)*(x))
#define ret return puts("-1"),0;
#define put putchar('\n')
#define inf 1000000005
#define mod 998244353
#define int ll
//#define N
using namespace std;
inline char gc(){static char buf[100000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;}
#define gc getchar
inline ll read(){char c=gc();ll su=0,f=1;for (;c<'0'||c>'9';c=gc()) if (c=='-') f=-1;for (;c>='0'&&c<='9';c=gc()) su=su*10+c-'0';return su*f;}
inline void write(ll x){if (x<0){putchar('-');write(-x);return;}if (x>=10) write(x/10);putchar(x%10+'0');}
inline void writesp(ll x){write(x),putchar(' ');}
inline void writeln(ll x){write(x);putchar('\n');}
int T,t,x0,yy,k;
bool a[3][3];
int l,r,mid,fx,ans,x;
signed main()
{
cin>>T;
while (T--)
{
cin>>t>>x0>>yy>>k;fx=0;
a[2][0]=0,a[1][0]=0,a[0][2]=0,a[0][1]=0;
cout<<0<<" "<<x0-1<<" "<<yy<<endl;
cin>>a[2][0];
cout<<0<<" "<<x0+1<<" "<<yy<<endl;
cin>>a[1][0];
cout<<0<<" "<<x0<<" "<<yy-1<<endl;
cin>>a[0][2];
cout<<0<<" "<<x0<<" "<<yy+1<<endl;
cin>>a[0][1];
if (a[0][2]) fx=1; else
if (a[0][1]) fx=3; else
fx=1;
if (fx==1)
{
l=0;r=t+1;ans=0;
while (l<=r)
{
mid=l+(r-l)/2;
cout<<0<<" "<<x0<<" "<<yy-mid<<endl;
cin>>x;
if (x==0)
{
ans=mid;
r=mid-1;
} else l=mid+1;
}
cout<<1<<" "<<((a[2][0])?(x0-(t-ans/2)):(x0+(t-ans/2)))<<" "<<yy-ans/2<<" "<<endl;
} else
{
l=0;r=t+1;ans=0;
while (l<=r)
{
mid=l+(r-l)/2;
cout<<0<<" "<<x0<<" "<<yy+mid<<endl;
cin>>x;
if (x==0)
{
ans=mid;
r=mid-1;
} else l=mid+1;
}
cout<<1<<" "<<((a[2][0])?(x0-(t-ans/2)):(x0+(t-ans/2)))<<" "<<yy+ans/2<<endl;
}
}
}
/*
0100
1110
0100
0000
*/