This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e6+10;
int N,M,K;
int dp[mxn];
int C = 0;
int ask(int x,int y = 1,int z = 1){
cout<<"? "<<x<<' '<<y<<' '<<z<<endl;
C++;
int re;
cin>>re;
if(re == -1)exit(0);
return re;
}
int main(){
memset(dp,-1,sizeof(dp));
cin>>N>>M>>K;
int l = 1,r = N;
while(r-l>1){
int mid = (l+r)>>1;
if(ask(mid)>=ask(mid+1))r = mid;
else l = mid+1;
}
if(l == r)cout<<"! "<<l<<" 1 1"<<endl;
else if(ask(l)<=ask(r))cout<<"! "<<r<<" 1 1"<<endl;
else cout<<"! "<<l<<" 1 1"<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |