Submission #597759

#TimeUsernameProblemLanguageResultExecution timeMemory
597759NekoRollyAliens (IOI07_aliens)C++17
30 / 100
3 ms252 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,x,y,M; ll Lx,Rx,Ly,Ry; ll l,r; int Query(ll m,int f){ string s; if (m < 1 || n < m) return -1; if (f) cout << "examine " << m << " " << y << endl; else cout << "examine " << x << " " << m << endl; cin >> s; return s == "true"; } void GoLR(bool f,ll &L,ll &R){ for (l=1, r=f?x:y; l<r; ){ ll m = (l+r)/2; if (Query(m, f)) r = m; else l = m+1; } L = l; for (l=f?x:y, r=n; l<r; ){ ll m = (l+r+1)/2; if (Query(m, f)) l = m; else r = m-1; } R = r, M = R - L + 1; // cout << L << " " << R << "\n"; if (M%3 == 0 && Query(L + M/3, f) == 0 && Query(L + M/3 - 1, f) == 1) M /= 3, R -= 2*M; if (M%5 == 0 && Query(L + M/5, f) == 0 && Query(L + M/5 - 1, f) == 1) M /= 5, R -= 4*M; for (; Query(L - 2*M, f) == 1; ) L -= 2*M, R -= 2*M; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> x >> y; GoLR(1, Lx, Rx), GoLR(0, Ly, Ry); if (Lx > M && Ly > M){ string s; cout << "examine " << Lx - M << " " << Ly - M << endl; cin >> s; if (s == "true") Lx -= M, Rx -= M; } // cout << Lx << " " << Ly << " " << M << endl; cout << "solution " << Lx + (5*M - 1)/2 << " " << Ly + (5*M - 1)/2 << 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...