Submission #234981

# Submission time Handle Problem Language Result Execution time Memory
234981 2020-05-26T14:04:55 Z nicolaalexandra Aliens (IOI07_aliens) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
int n,m,x,y;
int query (int x, int y){
    int ans;
    cout<<"examine "<<x<<" "<<y<<endl;
    cin>>ans;
    cout<<endl;
    return ans;
}
int main (){

    cin>>n>>x>>y;

    /// vreau sa determin coordonatele coltului patratului mic din care face parte x,y

    int st = 0, dr = n - y, sol = 0;
    while (st <= dr){
        int mid = (st+dr)>>1;
        if (query(x,y+mid) == 0) /// clar ma aflu prea sus
            dr = mid-1;
        else {
            /// testez mijlocul
            if (query (x,(2*y+mid)/2) == 0) /// tot prea sus
                dr = mid-1;
            else {
                int mid2 = (2*y+mid)/2;
                if (query(x,(y+mid2)/2) == 0)
                    dr = mid-1;
                else {
                    sol = mid;
                    st = mid+1;
                }}}}

    y += sol;

    st = 0, dr = x-1, sol = 0;
    while (st <= dr){
        int mid = (st+dr)>>1;
        if (query (x-mid,y) == 0)
            dr = mid-1;
        else {
            if (query((2*x-mid)/2,y) == 0)
                dr = mid-1;
            else {
                int mid2 = (2*x-mid)/2;
                if (query((x+mid2)/2,y) == 0)
                    dr = mid-1;
                else {
                    sol = mid;
                    st = mid+1;
                }}}}
    x -= sol;

    /// acum determin M ul la fel
    st = 0, dr = y-1, sol = 0;
    while (st <= dr){
        int mid = (st+dr)>>1;
        if (query(x,y-mid) == 0) /// clar ma aflu prea sus
            dr = mid-1;
        else {
            /// testez mijlocul
            if (query (x,(2*y-mid)/2) == 0) /// tot prea sus
                dr = mid-1;
            else {
                int mid2 = (2*y-mid)/2;
                if (query(x,(y+mid2)/2) == 0)
                    dr = mid-1;
                else {
                    sol = mid;
                    st = mid+1;
                }}}}

    m = sol + 1;

    /// stanga sus
    while (x - m >= 1 && y + m <= n){
        if (query (x-m,y+m))
            x -= m, y += m;
        else break;
    }

    /// stanga
    while (x - 2*m >= 1){
        if (query (x-2*m,y))
            x -= 2*m;
        else break;
    }

    /// sus
    while (y + 2*m <= n){
        if (query (x,y+2*m))
            y += 2*m;
        else break;
    }

    cout<<"solution "<<x + 2*m + m/2<<" "<<y - 2*m - m/2;



    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -