Submission #759509

#TimeUsernameProblemLanguageResultExecution timeMemory
759509rshohruhAliens (IOI07_aliens)C++14
30 / 100
1 ms288 KiB
#include <iostream> using namespace std; #define int long long int n; bool query(int x, int y){ if(x < 1 || x > n || y < 1 || y > n) return false; cout << "examine " << x << ' ' << y << endl; string s; cin >> s; return (s == "true" ? true : false); } signed main(){ int X, Y; cin >> n >> X >> Y; int l = 1, r = X, x, y; while(l != r){ x = (l + r) / 2; if(query(x, Y)) r = x; else l = x + 1; } int lx = l, m; l = X; r = n; while(l != r){ x = (l + r + 1) / 2; if(query(x, Y)) l = x; else r = x - 1; } int rx = l; if(!query((lx + rx) / 2, Y)) m = (rx - lx + 1) / 3; else if(!query(lx + (rx - lx + 1) / 5, Y)) m = (rx - lx + 1) / 5; else m = rx - lx + 1; l = Y - m; r = Y; x = lx + m / 2; while(l != r){ y = (l + r) / 2; if(query(x, y)) r = y; else l = y + 1; } y = l + m / 2; while(query(x - 2 * m, y)) x -= 2 * m; while(query(x, y - 2 * m)) y -= 2 * m; x += 2 * m; y += 2 * m; cout << "solution " << x << ' ' << y; 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...