Submission #114427

#TimeUsernameProblemLanguageResultExecution timeMemory
114427popovicirobertAliens (IOI07_aliens)C++14
100 / 100
3 ms512 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long // 217 // 44 using namespace std; ll N, X0, Y0, M; /*inline string in(int x, int y) { return ((x - X0) / M + (y - Y0) / M) % 2 == 0 ? "true" : "false"; }*/ inline bool ask(ll x, ll y) { //if(x < X0 || x >= X0 + 5 * M || y < Y0 || y >= Y0 + 5 * M) return 0; if(x > N || x <= 0 || y > N || y <= 0) return 0; cout << "examine "; cout << x << " " << y << "\n"; string str; cin >> str; //str = in(x, y); return str == "true" ? 1 : 0; } inline void solve(ll n, ll x0, ll y0) { ll x1 = x0, y1 = y0; int step = 0; while(ask(x1 - (1LL << step), y1)) { step++; } while(step > 0) { step--; if(ask(x1 - (1LL << step), y1)) { x1 -= (1LL << step); } } while(ask(x1, y1 - (1LL << step))) { step++; } while(step > 0) { step--; if(ask(x1, y1 - (1LL << step))) { y1 -= (1LL << step); } } ll x2 = x0, y2 = y0; while(ask(x2 + (1LL << step), y2)) { step++; } while(step > 0) { step--; if(ask(x2 + (1LL << step), y2)) { x2 += (1LL << step); } } ll m = x2 - x1 + 1; while(1) { if(ask(x1 - 2 * m, y1)) { x1 -= 2 * m; continue; } else if(ask(x1, y1 - 2 * m)) { y1 -= 2 * m; continue; } else if(ask(x1 - m, y1 - m)) { x1 -= m, y1 -= m; continue; } break; } cout << "solution " << x1 - 1 + 2 * m + (m + 1) / 2 << " " << y1 - 1 + 2 * m + (m + 1) / 2 << "\n"; } int main() { //ifstream cin("A.in"); //ofstream cout("A.out"); ll x0, y0; //ios::sync_with_stdio(false); //cin.tie(0), cout.tie(0); //cin >> N >> X0 >> Y0 >> M; cin >> N >> x0 >> y0; //ll x0 = 16, y0 = 6; solve(N, x0, y0); //cin.close(); //cout.close(); 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...