Submission #896661

#TimeUsernameProblemLanguageResultExecution timeMemory
896661NonozeAliens (IOI07_aliens)C++17
100 / 100
1 ms708 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define sz(x) (int)(x.size()) using namespace std; using namespace __gnu_pbds; typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int n, k, m; vector<int> a; map<pair<int, int>, bool> check; bool query(int x, int y) { if (check.count({x, y})) return check[{x, y}]; cout << "examine " << x << " " << y << endl; string ans; cin >> ans; if (ans=="true") return check[{x, y}]=true; else return check[{x, y}]=false; } void solve() { cin >> n; int x, y; cin >> x >> y; check[{x, y}]=true; int tempx=x, tempy=y; int ajout=1; while (tempx+ajout<=n && query(tempx+ajout, y)) { ajout*=2; } tempx+=ajout/2; int l=tempx, r=min(x+ajout, n); int rx=l; while (l<=r) { int mid=l+(r-l)/2; if (query(mid, y)) { rx=mid; l=mid+1; } else { r=mid-1; } } tempx=x, ajout=1; while (tempx-ajout>0 && query(tempx-ajout, y)) { ajout*=2; } tempx-=ajout/2; l=max(x-ajout, 1LL), r=tempx; int lx=l; while (l<=r) { int mid=l+(r-l)/2; if (query(mid, y)) { lx=mid; r=mid-1; } else { l=mid+1; } } m=rx-lx+1; ajout=1; while (tempy+ajout<=n && query(x, tempy+ajout)) { ajout*=2; } tempy+=ajout/2; l=tempy, r=min(y+ajout, n); int ry=l; while (l<=r) { int mid=l+(r-l)/2; if (query(x, mid)) { ry=mid; l=mid+1; } else { r=mid-1; } } int ly=ry-m+1; int midx=lx+m/2, midy=ly+m/2; while (midx+m<=n && midy+m<=n && query(midx+m, midy+m)) { midx+=m, midy+=m; } while (midx+2*m<=n && query(midx+2*m, midy)) { midx+=2*m; } while (midy+2*m<=n && query(midx, midy+2*m)) { midy+=2*m; } cout << "solution " << midx-2*m << " " << midy-2*m << endl; return; } signed main() { ios::sync_with_stdio(0); solve(); 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...