제출 #596295

#제출 시각아이디문제언어결과실행 시간메모리
596295angelo_torresAliens (IOI07_aliens)C++17
20 / 100
2 ms336 KiB
#include <bits/stdc++.h> using namespace std; // x0 y0; int n,xo,yo; int xr,xl,yr,yl; int main(){ cin >> n >> xo >> yo; int l,r; l = xo, r = n+1; for(int i = 0; xo + (1<<i) <= n; ++i){ cout << "examine " << xo + (1<<i) << " " << yo << endl; string ans; cin >> ans; if(ans == "false"){ r = xo + (1<<i); break; } } while(r-l > 1){ int md = (l+r)>>1; cout << "examine " << md << " " << yo << endl; string ans; cin >> ans; if(ans == "false") r = md; else l = md; } xr = l; l = xo, r = 0; for(int i = 0; xo - (1<<i) >= 1; ++i){ cout << "examine " << xo - (1<<i) << " " << yo << endl; string ans; cin >> ans; if(ans == "false"){ r = xo - (1<<i); break; } } while(l-r > 1){ int md = (l+r)>>1; cout << "examine " << md << " " << yo << endl; string ans; cin >> ans; if(ans == "false") r = md; else l = md; } xl = l; l = yo, r = n+1; for(int i = 0; yo + (1<<i) <= n; ++i){ cout << "examine " << xo << " " << yo + (1<<i) << endl; string ans; cin >> ans; if(ans == "false"){ r = yo + (1<<i); break; } } while(r-l > 1){ int md = (l+r)>>1; cout << "examine " << xo << " " << md << endl; string ans; cin >> ans; if(ans == "false") r = md; else l = md; } yr = l; // yr-yl = xr-xl yl = xl-xr+yr; int xc = (xl+xr)>>1, yc = (yl+yr)>>1, m = (xr-xl+1)<<1; bool le = 0,ri = 0; if(xc-m >= 1){ cout << "examine " << xc-m << " " << yc << endl; string ans; cin >> ans; if(ans == "true") le = 1; } if(xc+m <= n){ cout << "examine " << xc+m << " " << yc << endl; string ans; cin >> ans; if(ans == "true") ri = 1; } if(!le and ri) xc += m; if(le and !ri) xc -= m; bool up = 0,dw = 0; if(yc-m >= 1){ cout << "examine " << xc << " " << yc-m << endl; string ans; cin >> ans; if(ans == "true") dw = 1; } if(yc+m <= n){ cout << "examine " << xc << " " << yc+m << endl; string ans; cin >> ans; if(ans == "true") up = 1; } if(dw and !up) yc -= m; if(!dw and up) yc += m; cout << "solution " << xc << " " << yc << 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...