이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 <= 3 || yr-yl <= 3 || zr-zl <= 3)return;
pair<int,int> xra, yra, zra;
if(peak[1] < midx)xra = { xl, midx };
else xra = {midx, xr};
if(peak[2] < midy)yra = { yl, midy };
else yra = {midy, yr};
if(peak[3] < midz)zra = { zl, midz };
else zra = {midz, 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... |