제출 #896002

#제출 시각아이디문제언어결과실행 시간메모리
896002pccWorm Worries (BOI18_worm)C++14
0 / 100
203 ms508396 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 1e6+10; int N,M,K; int dp[mxn]; namespace CHECK{ vector<vector<vector<int>>> v; int ask(int x,int y = 1,int z = 1){ cout<<v[x][y][z]<<endl; return v[x][y][z]; } bool check(int x,int y = 1,int z = 1){ int re = v[x][y][z]>=max({v[x-1][y][z],v[x][y-1][z],v[x][y][z-1],v[x+1][y][z],v[x][y+1][z],v[x][y][z+1]}); if(!re)cerr<<"WA"<<endl; else cerr<<"AC"<<endl; return 0; } } int C = 0; int ask(int x,int y = 1,int z = 1){ //if(dp[x] != -1)return dp[x]; cout<<"? "<<x<<' '<<y<<' '<<z<<endl; C++; int re; //re = CHECK::ask(x,y,z); cin>>re; if(re == -1)exit(0); dp[x] = re; return re; } int main(){ memset(dp,-1,sizeof(dp)); cin>>N>>M>>K; CHECK::v = vector<vector<vector<int>>>(N+2,vector<vector<int>>(M+2,vector<int>(K+2,0))); //for(int i = 1;i<=N;i++)for(int j = 1;j<=M;j++)for(int k = 1;k<=K;k++)cin>>CHECK::v[i][j][k]; int l = 1,r = N; while(r-l>1){ int mid = (l+r)>>1; if(ask(mid)>=ask(mid+1))r = mid; else l = mid+1; } assert(r>=l&&r-l<=1); if(l == r)cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1); else if(ask(l)>ask(r))cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1); else cout<<"! "<<r<<" 1 1"<<endl,CHECK::check(r,1,1); cerr<<C<<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...