显然是UB。
求查UB QAQ
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,ans1,ans2,l=0,r=1e9,cnt=60,pos=0,pa=0;
int vis[1000005],p[10005];
int Get_Gcd(int x,int y)
{
if (y==0) return x;
return Get_Gcd(y,x%y);
}
int RAN(int k)
{
return (rand()*k)%998244353;
}
signed main()
{
srand((time(0)*7+998244353)%133333331);
cin>>n;
while (l<=r)
{
int mid=(l+r)>>1,flag;
cout<<"> "<<mid<<endl;
cin>>flag;
fflush(stdout);
cnt--;
if (flag==1) l=mid+1;
else ans1=mid,r=mid-1;
}
while (cnt--)
{
int rt=RAN(time(0))%n+1;
pa++;
if (pa>n) break;
while (vis[rt]) rt=RAN(time(0))%n+1;
vis[rt]=1;
cout<<"? "<<rt<<endl;
int x;
cin>>x;
p[++pos]=x;
fflush(stdout);
}
sort(p+1,p+pos+1);
for (int i=1;i<pos;i++) p[i]=p[i+1]-p[i];
ans2=p[1];
cout<<"!"<<' ';
for (int i=2;i<pos;i++) ans2=Get_Gcd(ans2,p[i]);
cout<<ans1-ans2*(n-1)<<' '<<ans2<<endl;
return 0;
}