Submission #867334

#TimeUsernameProblemLanguageResultExecution timeMemory
867334sleepntsheepAliens (IOI07_aliens)C++17
10 / 100
1 ms596 KiB
#include <iostream> #include <cassert> #include <vector> #include <algorithm> #include <deque> #include <set> #include <utility> #include <array> using namespace std; #define ALL(x) x.begin(), x.end() #define ShinLena cin.tie(nullptr)->sync_with_stdio(false); using ll = long long; int m, n, x, y, bl, bt, br; bool examine(int x, int y) { cout << "examine " << x << ' ' << y << '\n' << flush; char s[6]{0}; cin >> s; return s[0] == 't'; } void solution(int x, int y) { cout << "solution " << x << ' ' << y << "\n" << flush; exit(0); } void find_border() { int l = 1, r = x-1; while (l <= r) { int o = (l+r)/2; if (examine(o, y)) { int oo = (o+x)/2; if (examine(oo, y)) r = o - 1; else l = oo + 1, bl = oo; } else l = o + 1, bl = o; } l = x+1, r = n; while (l <= r) { int o = (l+r)/2; if (examine(o, y)) { int oo = (x+o)/2; if (examine(oo, y)) l = o + 1; else r = oo - 1, br = oo; } else r = o - 1, br = o; } m = br - bl - 1; assert(m%2); l = 1, r = y - 1; while (l <= r) { int o = (l+r)/2; if (examine(x, o)) { int oo = (o+y)/2; if (examine(x, oo)) r = o - 1; else l = oo + 1, bt = oo; } else l = o + 1, bt = o; } x = bl + 1; y = bt + 1; assert(examine(x, y)); } void find_11() { for (; x>2*m && examine(x-2*m, y); x-=2*m); for (; y>2*m && examine(x, y-2*m); y-=2*m); } void find_middle() { x += 2*m, y += 2*m; x += m/2, y += m/2; } int main() { ShinLena; cin >> n >> x >> y; find_border(); find_11(); find_middle(); 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...