Submission #342364

#TimeUsernameProblemLanguageResultExecution timeMemory
342364sofapudenAliens (IOI07_aliens)C++14
100 / 100
2 ms492 KiB
#include <bits/stdc++.h> using namespace std; int n, x, y, w1 = 0, h1 = 0, w2 = 0, h2 = 0, W = 0; int main(){ cin >> n >> x >> y; int l = 1, r = n/5+5; while(l <= r){ int mid = (l+r)>>1; int cx = mid+x; if(cx > n){ r = mid-1; continue; } cout << "examine " << cx << " " << y << endl; string an; cin >> an; if(an == "true"){ l = mid+1; w1 = mid; } else{ r = mid-1; } } l = 1, r = n/5+5; while(l <= r){ int mid = (l+r)>>1; int cx = x-mid; if(cx <= 0){ r = mid-1; continue; } cout << "examine " << cx << " " << y << endl; string an; cin >> an; if(an == "true"){ l = mid+1; w2 = mid; } else{ r = mid-1; } } l = 1, r = n/5+5; while(l <= r){ int mid = (l+r)>>1; int cy = mid+y; if(cy > n){ r = mid-1; continue; } cout << "examine " << x << " " << cy << endl; string an; cin >> an; if(an == "true"){ l = mid+1; h1 = mid; } else{ r = mid-1; } } l = 1, r = n/5+5; while(l <= r){ int mid = (l+r)>>1; int cy = y-mid; if(cy <= 0){ r = mid-1; continue; } cout << "examine " << x << " " << cy << endl; string an; cin >> an; if(an == "true"){ l = mid+1; h2 = mid; } else{ r = mid-1; } } x += (w1-w2)>>1; cout << "examine " << x << " " << y << endl; string an; cin >> an; if(an == "true"){ if((w1+w2+1)%5){ W = (w1+w2+1); } else{ int cu = (w1+w2+1)/5; x+=cu; cout << "examine " << x << " " << y << endl; cin >> an; x-=cu; if(an == "true")W = cu*5; else W = cu; } } else{ W = (w1+w2+1)/3; x-=W; } y += (h1-h2)>>1; cout << "examine " << x << " " << y << endl; cin >> an; if(an == "true"){ if((h1+h2+1)%5){ W = (h1+h2+1); } else{ int cu = (h1+h2+1)/5; y+=cu; cout << "examine " << x << " " << y << endl; cin >> an; y-=cu; if(an == "true")W = cu*5; else W = cu; } } else{ W = (h1+h2+1)/3; y-=W; } an = "true"; while(an == "true"){ x-=W*2; if(x <= 0)break; cout << "examine " << x << " " << y << endl; cin >> an; } x+=W*2; an = "true"; while(an == "true"){ y-=W*2; if(y <= 0)break; cout << "examine " << x << " " << y << endl; cin >> an; } y+=W; x-=W; if(!(x <= 0 || y <= 0)){ cout << "examine " << x << " " << y << endl; cin >> an; } else an = "false"; if(an == "false"){ y+=W, x+=W; } cout << "solution " << x+2*W << " " << y+2*W << 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...