제출 #837313

#제출 시각아이디문제언어결과실행 시간메모리
8373131075508020060209tcWorm Worries (BOI18_worm)C++14
0 / 100
3028 ms332 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long int n;int m;int K;int Q; map<pair<int,pair<int,int>>,int>mp; int ask(int x,int y,int z){ if(x==0){return 0;} if(x==n+1){return 0;} if(mp[{x,{y,z}}]){return mp[{x,{y,z}}];} cout<<"? "<<x<<" "<<y<<" "<<z<<endl; int ret; cin>>ret; mp[{x,{y,z}}]=ret; return ret; } void ot(int x,int y,int z){ cout<<"! "<<x<<" "<<y<<" "<<z<<endl; exit(0); } void chk(int x){ int a;int b;int c; a=ask(x-1,1,1); b=ask(x,1,1); c=ask(x+1,1,1); if(b>=a&&b>=c){ ot(x,1,1); } } signed main(){ cin>>n>>m>>K>>Q; int l=1;int r=n; int a;int b;int c;int d; a=ask(1,1,1); b=ask(2,1,1); c=ask(n-1,1,1); d=ask(n,1,1); if(a>=b){ot(1,1,1);} if(d>=c){ot(n,1,1);} while(l<r){ int mi=l+(r-l)/2; int v=ask(mi,1,1); if(v>=a){ r=mi; }else{ l=mi; } if(l+1==r){ chk(l); chk(r); } if(l+2==r){ chk(l); chk(l+1); chk(l+2); } } }
#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...