Submission #507961

#TimeUsernameProblemLanguageResultExecution timeMemory
507961ac2huAliens (IOI07_aliens)C++14
0 / 100
5 ms216 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int M = 31623; const int N = 2'000'000'000; bool check(int i,int j,int n){ if(i >0 && j >0 && i <= n && j <= n){ cout << "examine " << i << " " << j << endl; string s;cin >> s; fflush(stdout); return ((s == "true")? true : false); } return 0; } signed main(){ int n,x,y;cin >> n >> x >> y; int rx = x; for( ;rx<=n;rx++){ if(!check(rx,y,n)){ break; } } rx--; int ry = y; for(;ry<=n;ry++) if(!check(rx,ry,n)) break; ry--; int l = 0,r = n - max(rx,ry); while(l < r){ int mid = (l + r + 1)/2; if(check(rx + mid, ry + mid,n)) l = mid; else r = mid - 1; } pair<int,int> topcorner = {rx + l, ry + l}; l = 0,r = min(rx,ry) - 1; while(l < r){ int mid = (l + r + 1)/2; if(check(rx - mid,ry - mid, n)) l = mid; else r = mid - 1; } pair<int,int> bottomcorner = {rx - l,ry - l}; // cout << topcorner.first << " " << topcorner.second << endl; // cout << bottomcorner.first << " " << bottomcorner.second << endl; pair<int,int> center = {(topcorner.first + bottomcorner.first)/2,(topcorner.second + bottomcorner.second)/2}; cout << "solution " << center.first << " " << center.second << endl; }
#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...