#include using namespace std; int a(int i, int j) { cout << i << ' ' << j << "\n"; cout.flush(); int x; cin >> x; return x; } bool ok(int i) { if(i >= 0 && i < 200) return 1; return 0; } int f(int i1, int j1, int i2, int j2) { if(!ok(i1) || !ok(i2) || !ok(j1) || !ok(j2)) return 0; int ci1, ci2, cj1, cj2, miji, mijj, val; ci1 = i1; ci2 = i2; cj1 = j1; cj2 = j2; while(i1 <= i2 && j1 <= j2) { miji = (i1 + i2) / 2; mijj = (j1 + j2) / 2; val = a(miji, mijj); if(val == 0) return 1; if(val < 0) { i1 = miji + 1; j1 = mijj + 1; } else { i2 = miji - 1; j2 = mijj - 1; } } if(!f(ci1, j1, i2, cj2)) return f(i1, cj1, ci2, j2); else return 1; } int main() { //f(0, 0, 200 - 1, 200 - 1); int i, j; for(i = 0 ; i < 200 ; i++) { for(j = 0 ; j < 200 ; j++) { if(!a(i, j)) return 0; } } }