Submission #314171

#TimeUsernameProblemLanguageResultExecution timeMemory
314171sofapudenWorm Worries (BOI18_worm)C++14
0 / 100
126 ms256 KiB
#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 }; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...