#include #include using namespace std; int main(int argc, const char* argv[]) { int lowX = 0; // int lowY = 0; int highX = 100000; // int highY = 100000; int x = 0; int y = 0; auto fxy = [](int x, int y) { cout << x << " " << y << endl; int d; cin >> d; return d; }; auto fyx = [](int x, int y) { cout << y << " " << x << endl; int d; cin >> d; return d; }; // auto f = fxy; function f = fxy; int i = 0; for (int k = 0; k < 2; k++) { for (; i < 100; i++) { int ld = f(lowX, y); if (ld == 0) return 0; int hd = f(highX, y); if (hd == 0) return 0; if (ld < hd) { x = ld; highX -= (highX - lowX) / 2; } if (ld > hd) { x = hd; lowX += (highX - lowX) / 2; } if (ld == hd) { x = (ld + hd) / 2; break; } } if (i == 100) break; y = x; x = 0; lowX = 0; highX = 100000; f = fyx; i++; } return 0; }