# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369843 | 2021-02-22T15:41:48 Z | TLP39 | Aliens (IOI07_aliens) | C++14 | 2 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; char s[10]; bool que(int x,int y) { printf("examine %d %d\n",x,y); fflush(stdout); scanf("%s",s); if(s[0]=='t') return true; else return false; } int main() { int n,xi,yi; scanf("%d %d %d",&n,&xi,&yi); int hi,low,av; int maxm=n/5,m=1; int bot1,top1,left1,right1,bot5,left5; int ch1,ch2; hi=min(maxm,yi-1); low=0; while(hi>low) { av=(hi+low+1)/2; if(que(xi,yi-av)) { ch1=que(xi,yi-av/2); ch2=que(xi,yi-av/4); if(ch1 && ch2) low=av; else hi=av-1; } else hi=av-1; } bot1=yi-hi; m+=hi; hi=min(maxm,n-yi); low=0; while(hi>low) { av=(hi+low+1)/2; if(que(xi,yi+av)) { ch1=que(xi,yi+av/2); ch2=que(xi,yi+av/4); if(ch1 && ch2) low=av; else hi=av-1; } else hi=av-1; } top1=yi+hi; m+=hi; hi=min(m-1,xi-1); low=0; while(hi>low) { av=(hi+low+1)/2; if(que(xi-av,yi)) low=av; else hi=av-1; } left1=xi-hi; right1=xi-hi+m-1; int cap; for(cap=1;cap<=4;cap++) { if(yi-m*cap<1) break; if(cap%2) { if((xi-m<1 || !que(xi-m,yi-m*cap)) && (xi+m>n || !que(xi+m,yi-m*cap))) break; } else { if(!que(xi,yi-m*cap)) break; } } bot5=bot1-m*(cap-1); for(cap=1;cap<=4;cap++) { if(xi-m*cap<1) break; if(cap%2) { if((yi-m<1 || !que(xi-m*cap,yi-m)) && (yi+m>n || !que(xi-m*cap,yi+m))) break; } else { if(!que(xi-m*cap,yi)) break; } } left5=left1-m*(cap-1); printf("solution %d %d\n",left5+(5*m-1)/2,bot5+(5*m-1)/2); fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 364 KB | Output is correct |
3 | Correct | 2 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 2 ms | 364 KB | Output is correct |