Submission #157354

# Submission time Handle Problem Language Result Execution time Memory
157354 2019-10-11T03:05:07 Z Autoratch Aliens (IOI07_aliens) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
using namespace std;
 
int n,x,y,ox,oy,l,r,up,lo,sz;
 
bool check(int x,int y)
{
    cout << "examine " << x << ' ' << y; cout << flush;
//    return examine(x,y);
    string s; cin >> s;
    return s=="true";
}
 
int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0);
 
    cin >> n >> x >> y;
//get_size_and_start(n,x,y);
//cout << check(x,y) << endl;
    ox = x,oy = y;
    l = x,r = n;
 //   return 0;
    for(int i = 1;x+i <= n;i*=2)
    {
        if(!check(x+i,y)){ r = x+i; break; }
        else if(!check(x+i+1,y)){ r = x+i+1; break; }
        else l = x+i;
        x+=i;
    }
return 0;
    while(l<r)
    {
        int m = (l+r)/2;
        if(check(m,y))
        { 
            if(!check(m+1,y)){ l = m; break; } 
            else l = m+1; 
        }
        else r = m;
    }
//return 0;
    //  return 0;
//cout << "still ok";
//cout.flush();
//cout << l;
    up = l;
    x = ox,y = oy;
    l = 1,r = x;
    for(int i = 1;x-i >= 1;i*=2)
    {
//        cout << x << ' ' << x-i << endl;
        if(!check(x-i,y)){ l = x-i; break; }
        else if(!check(x-i-1,y)){ l = x-i-1; break; }
        else r = x-i;
        x-=i;
    }
    while(l<r)
    {
        int m = (l+r)/2;
  //      cout << l << ' ' << m << ' ' << r << endl;
    //    cout << check(m,y) << endl;
        if(check(m,y))
        {
            if(!check(m-1,y)){ l = m; break; }
            else r = m;
        }
        else l = m+1;
    }
   // cout << r << endl;
//   cout << lo << ' ' << up << ' ' << sz << endl;
    lo = l,sz = up-lo+1;
 //   cout << lo << ' ' << up << ' ' << sz << endl;
    x = ox,y = oy;
    while(check(x-sz,y-sz)) x-=sz,y-=sz;
    while(check(x-sz*2,y)) x-=sz*2;
    while(check(x,y-sz*2)) y-=sz*2;
    l = x-sz,r = x;
    while(l<r)
    {
        int m = (l+r)/2;
        if(check(m,y))
        {
            if(!check(m-1,y)){ l = m; break; }
            else r = m;
        }
        else l = m+1;
    }
//return 0;
    x = l;
    l = y-sz,r = y;
    while(l<r)
    {
        int m = (l+r)/2;
        if(check(x,m))
        {
            if(!check(x,m-1)){ l = m; break; }
            else r = m;
        }
        else l = m+1;
    }
    y = l;
    cout << x+sz*2+sz/2 << ' ' << y+sz*2+sz/2;
cout << flush;
    //solution(x+sz*2+sz/2,y+sz*2+sz/2);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 380 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -