Submission #436118

#TimeUsernameProblemLanguageResultExecution timeMemory
436118dutchAliens (IOI07_aliens)C++17
30 / 100
4 ms272 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n, x, y; bool q(int i, int j){ if(min(i, j) < 1 || max(i, j) > n) return 0; cout << "examine " << i << ' ' << j << endl; string res; cin >> res; return res[0] == 't'; } signed main(){ cin.tie(0)->sync_with_stdio(0); cin >> n >> x >> y; int xMax = x, xMin = x, yMax = y; for(int i=1<<30, j; i/=2; ){ j = xMax + i; if(q(j, y)){ if(q((j+xMax)/2, y) && q(xMax+(i+3)/4, y)) xMax += i; } j = yMax + i; if(q(x, j)){ if(q(x, (j+yMax)/2) && q(x, yMax+(i+3)/4)) yMax += i; } j = xMin - i; if(q(j, y)){ if(q((j+xMin)/2, y) && q(xMin-(i+3)/4, y)) xMin -= i; } } int w = 2*(xMax - xMin + 1); int yMin = yMax - (xMax - xMin); x = (xMin + xMax) / 2; y = (yMin + yMax) / 2; xMin = xMax = x; yMin = yMax = y; if(q(x-w, y)) xMin -= w; if(q(x-w, y)) xMin -= w; if(q(x+w, y)) xMax += w; if(q(x+w, y)) xMax += w; if(q(x, y-w)) yMin -= w; if(q(x, y-w)) yMin -= w; if(q(x, y+w)) yMax += w; if(q(x, y+w)) yMax += w; cout << "solution " << (xMin+xMax)/2 << ' ' << (yMin+yMax)/2 << endl; }
#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...