#include #include using namespace std; int rez1 = 1, rez2 = 1; int mat[200][200]; void divide(int x, int y, int x1, int y1){ if (rez1 == 0 or rez2 == 0) return; if (x >= x1 or y >= y1) return; if (mat[x][y] != 0 and mat[x1][y1] != 0) return; cout << x << " " << y << '\n'; cout.flush(); cin >> rez1; if (rez1 == 0) return; cout << x1 << " " << y1 << '\n'; cout.flush(); cin >> rez2; if (rez2 == 0) return; mat[x][y] = rez1; mat[x1][y1] = rez2; if (rez1 < 0 and rez2 > 0){ divide(x, y, x + x1 / 2, y + y1 / 2); divide(x, y + y1 / 2, x + x1 / 2, y1); divide(x + x1 / 2, y, x1, y + y1 / 2); divide(x + x1 / 2, y + y1 / 2, x1, y1); } } int main(){ divide(0, 0, 3, 3); }