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;
int peak[4];
int n, m, k;
void find(int xl, int xr, int yl, int yr, int zl, int zr){
int midx = (xl+xr)>>1;
int midy = (yl+yr)>>1;
int midz = (zl+zr)>>1;
int cur;
for(int i = xl; i <= xr; ++i){
for(int j = -1; j <= 1; ++j){
for(int ij = -1; ij <= 1; ++ij){
if(!(midy + j) || midy + j >= m)continue;
if(!(midz + ij) || midz + ij >= k)continue;
cout << "? " << i << " " << midy+j << " " << midz + ij << endl;
cin >> cur;
if(peak[0] < cur){
peak[0] = cur;
peak[1] = i;
peak[2] = midy+j;
peak[3] = midz+ij;
}
}
}
}
for(int i = yl; i <= yr; ++i){
for(int j = -1; j <= 1; ++j){
for(int ij = -1; ij <= 1; ++ij){
if(!(midx + j) || midx + j >= n)continue;
if(!(midz + ij) || midz + ij >= k)continue;
cout << "? " << midx + j << " " << i << " " << midz + ij << endl;
cin >> cur;
if(peak[0] < cur){
peak[0] = cur;
peak[1] = midx + j;
peak[2] = i;
peak[3] = midz + ij;
}
}
}
}
for(int i = zl; i <= zr; ++i){
for(int j = -1; j <= 1; ++j){
for(int ij = -1; ij <= 1; ++ij){
if(!(midy + j) || midy + j >= m)continue;
if(!(midx + ij) || midx + ij >= n)continue;
cout << "? " << midx+ij << " " << midy+j << " " << i << endl;
cin >> cur;
if(peak[0] <= cur){
peak[0] = cur;
peak[1] = midx+ij;
peak[2] = midy+j;
peak[3] = i;
}
}
}
}
if(peak[1] == midx || peak[2] == midy || peak[3] == midz)return;
if(xr-xl <= 2 || yr-yl <= 2 || zr-zl <= 2)return;
pair<int,int> xra, yra, zra;
if(peak[1] < midx)xra = { xl, midx-2 };
else xra = {midx+2, xr};
if(peak[2] < midy)yra = { yl, midy-2 };
else yra = {midy+2, yr};
if(peak[3] < midz)zra = { zl, midz-2 };
else zra = {midz+2, zr};
find(xra.first,xra.second,yra.first,yra.second,zra.first,zra.second);
}
int main(){
cin >> n >> m >> k;
if(k != 1){
find(1,n,1,m,1,k);
}
cout << "! " << peak[1] << " " << peak[2] << " " << peak[3] << endl;
}
# | 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... |