#include using namespace std; int n = 200; int freee = n * n; int A[500][500], S[500][500]; int getmin(int i, int j) { int m1 = S[i][j]; int m2 = S[n-1][n-1]; if(i > 0) m2 -= S[i-1][n-1]; if(j > 0) m2 -= S[n-1][j-1]; if(i > 0 && j > 0) m2 += S[i-1][j-1]; return min(m1, m2); } pair rand_lc() { int best = -1; pair ret; for(int i=0; i 0) S[i][j] += S[i-1][j]; if(j > 0) S[i][j] += S[i][j-1]; if(i > 0 && j > 0) S[i][j] -= S[i-1][j-1]; } for(int i=0; i lc) { int a; cout << lc.first << " " << lc.second << endl; cin >> a; return a; } int main() { srand(time(0)); while(true) { auto p = rand_lc(); int q = query(p); if(q == 0) return 0; if(q > 0) { for(int i=p.first; i