// No.513 宝探し2 // https://yukicoder.me/problems/no/513 // #include using namespace std; int check_distance(int x, int y); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int dist; dist = check_distance(0, 0); int lx = 0; int rx = dist; bool lx_update = true; bool rx_update = true; int ldist = 0; int rdist = 0; while (dist != 0) { if (lx_update) { ldist = check_distance(lx, dist - lx); lx_update = false; if (ldist == 0) break; } if (rx_update) { rdist = check_distance(rx, dist - rx); rx_update = false; if (rdist == 0) break; } if (ldist == rdist) { lx = (lx + rx) / 2; lx_update = true; } else if (ldist < rdist) { rx = (lx + rx) / 2; rx_update = true; } else { lx = (lx + rx) / 2; lx_update = true; } } } int check_distance(int x, int y) { cout << x << " " << y << endl << flush; int res; cin >> res; return res; }