#include using namespace std; const int N = 200; int A[N + 1][N + 1]; int main() { srand(time(nullptr)); int x = N / 2; int y = N / 2; bool found = 0; int X, Y; while (true) { cout << x << " " << y << "\n"; cout.flush(); int height; cin >> height; A[x][y] = height; if (height == 0) break; if (height < 0) { found = true; X = x; Y = y; break; } if (!found) { if (x > 0 && y > 0) { if (rand() & 1) x--; else y--; } else { if (x > 0) x--; else y--; } } } int i = X, j; int limitY = N; while (i <= N) { j = Y; while (j <= limitY) { cout << i << " " << j << "\n"; cout.flush(); int height; cin >> height; A[i][j] = height; if (height == 0) return 0; if (height > 0) { limitY = j - 1; break; } else j++; } i++; } return 0; }