제출 #653683

#제출 시각아이디문제언어결과실행 시간메모리
653683grtAliens (IOI07_aliens)C++17
80 / 100
4 ms312 KiB
//GRT_2018 #include <bits/stdc++.h> #define PB push_back #define ST first #define ND second //mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; bool ask(int x, int y) { cout << "examine " << x << " " << y << endl; string s; cin >> s; return s == "true"; } int n, x_0, y_0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> x_0 >> y_0; { int bad = -1; for(int i = 0; ; ++i) { int y = min(n, y_0 + (1 << i)); if(!ask(x_0, y)) { bad = y; break; } else if(y == n) { break; } y_0 = y; } if(bad == -1) { y_0 = n; } else { int low = y_0, high = bad, mid; while(low <= high) { mid = (low + high) >> 1; if(ask(x_0, mid)) { low = mid + 1; } else { high = mid - 1; } } y_0 = low - 1; } } { int bad = -1; for(int i = 0; ; ++i) { int x = min(n, x_0 + (1 << i)); if(!ask(x, y_0)) { bad = x; break; } else if(x == n) { break; } x_0 = x; } if(bad == -1) { x_0 = n; } else { int low = x_0, high = bad, mid; while(low <= high) { mid = (low + high) >> 1; if(ask(mid, y_0)) { low = mid + 1; } else { high = mid - 1; } } x_0 = low - 1; } } int m = -1; { int bad = -1; int pos = x_0; for(int i = 0; ; ++i) { int x = max(1, pos - (1 << i)); if(!ask(x, y_0)) { bad = x; break; } else if(x == 1) { break; } pos = x; } int low = bad, high = pos, mid; while(low <= high) { mid = (low + high) >> 1; if(ask(mid, y_0)) { high = mid - 1; } else { low = mid + 1; } } m = x_0 - (high + 1) + 1; } while((x_0 - m) >= 1 && (y_0 - m) >= 1 && ask(x_0 - m, y_0 - m)) { x_0 -= m; y_0 -= m; } while((x_0 - 2*m) >= 1 && ask(x_0 - 2 * m, y_0)) { x_0 -= 2 * m; } while((y_0 - 2 * m) >= 1 && ask(x_0, y_0 - 2 * m)) { y_0 -= 2 * m; } x_0 -= (m - 1); y_0 -= (m - 1); cout << "solution " << x_0 + 2 * m + m/2 << " " << y_0 + 2 * m + m/2; }
#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...