Submission #808781

#TimeUsernameProblemLanguageResultExecution timeMemory
808781LiudasAliens (IOI07_aliens)C++17
30 / 100
4 ms300 KiB
#include <iostream> using namespace std; int main() { int N, x, y; cin >> N >> x >> y; int u = 0, l = 0, r = 0, d = 0; bool flat = true; while(flat && x + r < N){ cout << "examine " << x + r + 1 << " " << y << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ r ++; } } flat = true; while(flat && x - l > 1){ cout << "examine " << x - l - 1 << " " << y << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ l++; } } flat = true; while(flat && y + u < N){ cout << "examine " << x << " " << y + u + 1 << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ u ++; } } flat = true; while(flat && y - d > 1){ cout << "examine " << x << " " << y - d - 1 << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ d ++ ; } } int midx = (2 * x + r - l) / 2, midy = (2 * y + u - d) / 2; int s = r + l + 1; int cl = 0, cr = 0, cu = 0, cd = 0; flat = true; while(flat && midx + 2 * s * (cr + 1) <= N){ cout << "examine " << midx + 2 * s * (cr + 1) << " " << midy << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ cr++ ; } } flat = true; while(flat && midx - 2 * s * (cl + 1) >= 1){ cout << "examine " << midx - 2 * s * (cl + 1) << " " << midy << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ cl++ ; } } flat = true; while(flat && midy + 2 * s * (cu + 1) <= N){ cout << "examine " << midx << " " << midy + 2 * s * (cu + 1) << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ cu++ ; } } while(flat && midy - 2 * s * (cd + 1) >= 1){ cout << "examine " << midx << " " << midy - 2 * s * (cd + 1) << endl; string ans; cin >> ans; if(ans != "true"){ flat = false; } else{ cd++; } } if(cl + cr == 2){ cout << "solution "; if(cl == cr){ cout << midx << " "; } if(cl == 0){ cout << midx + s * 2 << " "; } if(cl == 2){ cout << midx - s * 2 << " "; } if(cu == cd){ cout << midy << " "; } if(cd == 0){ cout << midy + s * 2 << " "; } if(cd == 2){ cout << midy - s * 2 << " "; } cout << endl; } else{ cout << "solution "; if(cl == 0){ cout << midx + s << " "; } if(cl == 1){ cout << midx - s << " "; } if(cu == 0){ cout << midy - s << " "; } if(cu == 1){ cout << midy + s << " "; } cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...