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;
typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define sz(v) (int)v.size()
typedef string str;
#define FOR(i,a,b) for(int i=a; i<b; i++)
void IO(){
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
//------------------------------------------------------//
void ckmin(int &x, int y){x=min(x,y);}
const int MX=1e6+10;
int N,M,K,Q,memo[MX][2][2];
int get(int x, int y, int z){
if(min(x,min(y,z))<1 || x>N || y>M || z>K) return 0;
if(memo[x][y][z]!=-1) return memo[x][y][z];
cout << "? " << x << ' ' << y << ' ' << z << endl;
int val; cin>>val;
return memo[x][y][z]=val;
}
void answer(int x, int y, int z){
cout << "! " << x << ' ' << y << ' ' << z << endl;
cout.flush();
exit(0);
}
int main(){
IO();
cin>>N>>M>>K>>Q;
memset(memo,-1,sizeof(memo));
int l=1,r=N;
while(l<=r){
int m=(l+r)/2;
int x=get(m-1,1,1),y=get(m,1,1),z=get(m+1,1,1);
if(y>=max(x,z)) answer(m,1,1);
if(x>y) r=m-1;
else l=m+1;
}
}
# | 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... |