#include <bits/stdc++.h>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
using namespace std;
vector<int> a;
map<pair<int,pair<int,int>>,int> req;
int n,m,k,q;
void give_ans(int x, int y, int z){
cout << "! " << x+1 << " " << y+1 << " " << z+1 << endl;
return;
}
int ask(int x, int y, int z){
if(req.find({x,{y,z}})!=req.end()) return req[{x,{y,z}}];
if(x<0||x>=n||y<0||y>=m||z<0||z>=k) return 1e9;
cout << "? " << x+1 << " " << y+1 << " " << z+1 << endl;
int ans; cin>>ans;
req[{x,{y,z}}]=ans;
return ans;
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> m >> k >> q;
int l=0; int r=n-1;
double GR=0.618;
double GR2=0.382;
while(l<r){
double mid1=round((double)l*GR+(double)r*GR2);
double mid2=round((double)l*GR2+(double)r*GR);
if(mid2<mid1) swap(mid1,mid2);
int amid1=ask(mid1,0,0);
int amid2=ask(mid2,0,0);
if(amid1>=amid2){
r=mid1-1;
}else{
l=mid2+1;
}
}
give_ans(l,0,0);
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... |