제출 #226012

#제출 시각아이디문제언어결과실행 시간메모리
226012MKopchevWorm Worries (BOI18_worm)C++14
59 / 100
868 ms6048 KiB
#include<bits/stdc++.h> using namespace std; map< pair<int, pair<int,int> >,int > seen; int n,m,k,q; mt19937 rng(42); int ask(pair<int, pair<int,int> > now) { if(seen.count(now))return seen[now]; cout<<"? "<<now.first<<" "<<now.second.first<<" "<<now.second.second<<endl; int ret; cin>>ret; seen[now]=ret; return ret; } int x_moves[6]={1,-1,0,0,0,0}; int y_moves[6]={0,0,1,-1,0,0}; int z_moves[6]={0,0,0,0,1,-1}; int main() { cin>>n>>m>>k>>q; pair<int, pair<int,int> > best; for(int i=1;i<=q/2;i++) { int x=rng()%n+1; int y=rng()%m+1; int z=rng()%k+1; pair<int, pair<int,int> > current={x,{y,z}}; if(i==1)best=current; else if(ask(best)<ask(current))best=current; } while(1) { bool stop=1; for(int i=0;i<6;i++) { int x_=best.first+x_moves[i]; int y_=best.second.first+y_moves[i]; int z_=best.second.second+z_moves[i]; if(1<=x_&&x_<=n&&1<=y_&&y_<=m&&1<=z_&&z_<=k) { pair<int, pair<int,int> > current={x_,{y_,z_}}; if(ask(current)>ask(best)){best=current;stop=0;break;} } } if(stop) { cout<<"! "<<best.first<<" "<<best.second.first<<" "<<best.second.second<<endl; return 0; } } return 0; }
#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...