Submission #1127608

#TimeUsernameProblemLanguageResultExecution timeMemory
1127608LudisseyWorm Worries (BOI18_worm)C++20
12 / 100
44 ms1056 KiB
#include <bits/stdc++.h> #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() using namespace std; vector<int> a; map<pair<int,pair<int,int>>,int> req; int n,m,k,q; void give_ans(int x, int y, int z){ cout << "! " << x+1 << " " << y+1 << " " << z+1 << endl; return; } int ask(int x, int y, int z){ if(req.find({x,{y,z}})!=req.end()) return req[{x,{y,z}}]; if(x<0||x>=n||y<0||y>=m||z<0||z>=k) return -1e9; cout << "? " << x+1 << " " << y+1 << " " << z+1 << endl; int ans; cin>>ans; req[{x,{y,z}}]=ans; return ans; } pair<int,int> linemax(int y){ int mx=0; int mxI=0; for (int i = 0; i < n; i++) { int a=ask(i,y,0); if(mx<a){ mx=max(ask(i,y,0),mx); mxI=i; } } return {mx,mxI}; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k >> q; int l=0; int r=m-1; while(l<r){ int mid1=l+(r-l)/3; int mid2=r-(r-l)/3; int amid1=linemax(mid1).first; int amid2=linemax(mid2).first; if(amid1<amid2){ l=mid1+1; }else{ r=mid2-1; } } give_ans(linemax(l).second,l,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...