답안 #843752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
843752 2023-09-04T13:58:54 Z Mularstyle Aliens (IOI07_aliens) C++14
100 / 100
1 ms 424 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool test(ll x,ll y)
{
    string s;
    printf("examine %lld %lld\n",x,y);
    cin>>s;
    return s=="true";

}

ll N,xo,yo;
ll M;
ll lo,ro,uo,to;
ll cx,cy;
ll l,r;
int main()
{

    cin>>N>>xo>>yo;
    ll jump=1;
    while( xo+jump <= N and test(xo+jump,yo) )jump*=2;
    l= xo+ jump/2;
    r=min(xo+jump,N);
    while(l<r)
    {
        ll mid=(l+r+1)/2;
        if(test(mid,yo))
            l=mid;
        else
            r=mid-1;
    }
    jump=1;
    ro=l;

    while( xo-jump >= 1 and test(xo-jump,yo) )jump*=2;
    l=max(xo-jump,(ll)1);
    r=xo-jump/2;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(test(mid,yo))
            r=mid;
        else
            l=mid+1;
    }
    jump=1;
    lo=l;

     while( yo-jump >= 1 and test(xo,yo-jump) )jump*=2;
    l=max(yo-jump,(ll)1);
    r=yo-jump/2;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(test(xo,mid))
            r=mid;
        else
            l=mid+1;
    }
    jump=1;
    uo=l;


     while( yo+jump <= N and test(xo,yo+jump) )jump*=2;
    l= yo+ jump/2;
    r=min(yo+jump,N);
    while(l<r)
    {
        ll mid=(l+r+1)/2;
        if(test(xo,mid))
            l=mid;
        else
            r=mid-1;
    }
    jump=1;
    to=l;

    M=ro-lo+1;

    cx=(lo+ro)/2;
    cy=(uo+to)/2;

    jump=1;
    //cout<<cx<<" "<<cy<<"\n";



    while( cx+ M <= N and cy+M<=N and test(cx+M,cy+M) )
    {
        cx+=M;
        cy+=M;
    }

    while( cx+ 2*M*jump <= N and test(cx+2*M*jump,cy) )
        jump++;
    cx=cx+2*M*(jump-1);
    jump=1;

    while( cy+ 2*M*jump <= N and test(cx,cy+2*M*jump) )
        jump++;
    cy=cy+2*M*(jump-1);
    cx-=2*M;
    cy-=2*M;

    printf("solution %lld %lld",cx,cy);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct