Submission #1259894

#TimeUsernameProblemLanguageResultExecution timeMemory
1259894user736482Worm Worries (BOI18_worm)C++20
22 / 100
407 ms5764 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define MOD 1000000007 #define INF 1000000019 #define POT (1<<20) #define INFL 1000000000000000099LL ll Q; ll a,b,c,bst,X,Y,Z,d,e,f,K; ll cnt=0; map<vector<ll>,ll>mp; ll zap(ll x,ll y,ll z){ if(x<1 || y<1 || z<1 || x>X || y>Y || z>Z)return -1; if(mp[{x,y,z}]); cout<<"? "<<x<<" "<<y<<" "<<z<<endl; ll ans=10000000-abs(182009-x); cin>>ans; mp[{x,y,z}]=ans; cnt++; return ans; } mt19937 rng(0); ll mt(){ ll XX=rng(); return abs(XX); } int main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin>>a>>b>>c>>Q; X=a; Y=b; Z=c; K=Q/3; for(ll i=0;i<K;i++){ d=mt()%X+1; e=mt()%Y+1; f=mt()%Z+1; ll k=zap(d,e,f); if(k>bst){ bst=k; a=d; b=e; c=f; } } vector<vector<ll>>v={{-1,0,0},{1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0-1}}; while(cnt<Q){ for(auto i : v){ if(cnt==Q)break; d=a+i[0]; e=b+i[1]; f=c+i[2]; ll k=zap(d,e,f); if(k>bst){ bst=k; a=d; b=e; c=f; break; } } } cout<<"! "<<a<<" "<<b<<" "<<c; }
#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...