제출 #114415

#제출 시각아이디문제언어결과실행 시간메모리
114415popovicirobertAliens (IOI07_aliens)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long // 217 // 44 using namespace std; int 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(int x, int 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(int n, int x0, int y0) { int x1 = x0, y1 = y0; int step = 0; while(ask(x1 - (1 << step), y1)) { step++; } while(step > 0) { step--; if(ask(x1 - (1 << step), y1)) { x1 -= (1 << step); } } while(ask(x1, y1 - (1 << step))) { step++; } while(step > 0) { step--; if(ask(x1, y1 - (1 << step))) { y1 -= (1 << step); } } int x2 = x0, y2 = y0; while(ask(x2 + (1 << step), y2)) { step++; } while(step > 0) { step--; if(ask(x2 + (1 << step), y2)) { x2 += (1 << step); } } int m = x2 - x1 + 1; while(ask(x1 - 2 * m, y1)) { x1 -= 2 * m; } while(ask(x1, y1 - 2 * m)) { y1 -= 2 * m; } 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"); int x0, y0; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); //cin >> N >> X0 >> Y0 >> M; cin >> N >> x0 >> y0; //int x0 = 7, y0 = 4; 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...