/* * 513.cpp */ //include files #include #include using namespace std; //DEFINE MACROS #define MIN(a,b) (a>b?b:a) #define MAX(a,b) (a>b?a:b) #define PRINTLN(s) cout << s << endl //DEFINE CONSTANT #define MAX_LEN 100000 //DEFINE PROTOTYPE int main(){ int count = 0; pair start = make_pair(0,0); while(1){ pair query = make_pair(0,0);; pair minquery = make_pair(0,0);; int min; for (int i = 0; i < 4; ++i) { if(count > 100 ){ cout << "error" << "\n"; return -1; } int side = MAX_LEN/(count+1); switch(i){ case 1: query = make_pair(start.first+side/2,start.first+side); break; case 2: query = make_pair(side+start.first+side/2,start.first+side); break; case 3: query = make_pair(start.first+side/2,side+start.first+side); break; case 4: query = make_pair(side+start.first+side/2,side+start.first+side); break; } cout << query.first << " "<< query.second << "\n"; int d; cin >> d; if(d ==0 ) return 0; if(d d){ min = d; minquery = query; } } count++; } start = minquery; } return 0; }