Submission #642292

#TimeUsernameProblemLanguageResultExecution timeMemory
642292devariaotaAliens (IOI07_aliens)C++17
0 / 100
3 ms208 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<ll> vll; const ll mod=1e9+7; const ll maxn=2e6+5; const ll INF=1e18; #define ok ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define fi first #define se second #define pb push_back #define ub upper_bound #define lb lower_bound #define endl '\n' int n, x, y, l, r, u, d, mx=-1, xx=1, yy=1; string jwb; int main() { ok cin >> n >> x >> y; for(int i=0; i<=30; i++) { ll nx=x+(1<<i); if(nx>n || nx<1) break; cout << "examine " << nx << " " << y << endl; cout.flush(); cin >> jwb; if(jwb=="true") { mx=i; } else break; } if(mx>=0) { r=x+(1<<mx); } else r=x; for(int i=mx-1; i>=0; i--) { ll nx=r+(1<<i); if(nx>n || nx<1) continue; cout << "examine " << nx << " " << y << endl; cout.flush(); cin >> jwb; if(jwb=="true") { r+=(1<<i); } } mx=-1; for(int i=0; i<=30; i++) { ll nx=x-(1<<i); if(nx>n || nx<1) break; cout << "examine " << nx << " " << y << endl; cout.flush(); cin >> jwb; if(jwb=="true") { mx=i; } else break; } if(mx>=0) { l=x-(1<<mx); } else l=x; for(int i=mx-1; i>=0; i--) { ll nx=l-(1<<i); if(nx>n || nx<1) continue; cout << "examine " << nx << " " << y << endl; cout.flush(); cin >> jwb; if(jwb=="true") { l-=(1<<i); } } mx=-1; for(int i=0; i<=30; i++) { ll nx=y+(1<<i); if(nx>n || nx<1) break; cout << "examine " << x << " " << nx << endl; cout.flush(); cin >> jwb; if(jwb=="true") { mx=i; } else break; } if(mx>=0) { u=y+(1<<mx); } else u=y; for(int i=mx-1; i>=0; i--) { ll nx=u+(1<<i); if(nx>n || nx<1) continue; cout << "examine " << x << " " << nx << endl; cout.flush(); cin >> jwb; if(jwb=="true") { u+=(1<<i); } } mx=-1; for(int i=0; i<=30; i++) { ll nx=y-(1<<i); if(nx>n || nx<1) break; cout << "examine " << x << " " << nx << endl; cout.flush(); cin >> jwb; if(jwb=="true") { mx=i; } else break; } if(mx>=0) { d=y-(1<<mx); } else d=y; for(int i=mx-1; i>=0; i--) { ll nx=d-(1<<i); if(nx>n || nx<1) continue; cout << "examine " << x << " " << nx << endl; cout.flush(); cin >> jwb; if(jwb=="TRUE") { d-=(1<<i); } } int sz=u-d+1; for(int i=2; i<=3; i++) { ll nx=l-2*sz; if(nx>n || nx<1) break; cout << "examine " << nx << " " << y << endl; cout.flush(); cin >> jwb; if(jwb=="true") { xx=i; } else break; } for(int i=2; i<=3; i++) { ll nx=d-2*sz; if(nx>n || nx<1) break; cout << "examine " << x << " " << nx << endl; cout.flush(); cin >> jwb; if(jwb=="true") { yy=i; } else break; } ll midx=(l+r)/2; ll midy=(u+d)/2; cout <<"solution " << midx+(2-xx)*2*sz << " " << midy+(2-yy)*2*sz << endl; cout.flush(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...