Submission #151216

# Submission time Handle Problem Language Result Execution time Memory
151216 2019-09-02T08:46:20 Z georgerapeanu Aliens (IOI07_aliens) C++11
0 / 100
5 ms 396 KB
#include <iostream>

using namespace std;

int n,x,y;
    
bool ask(int x,int y){
    if(x < 1 || x > n || y < 1 || y > n){
        return false;
    }
    string ans;
    cout << "examine " << x << " " << y << endl;
    cin >> ans;
    return (ans == "true");
}

void answer(int x,int y){
    cout << "solution " << x << " " << y << endl;
}

int main(){
    cin >> n >> x >> y;

    int delta = 1;

    while(ask(x,y + delta) == true){
        delta *= 2;
    }
   
    delta /= 2;
   
    for(;delta;delta /= 2){
        if(ask(x,y + delta) == true){
            y += delta;
        }
    }

    delta = 1;
    while(ask(x + delta,y) == true){
        delta *= 2;
    }
    
    delta /= 2;
    
    for(;delta;delta /= 2){
        if(ask(x + delta,y) == true){
            x += delta;
        }
    }

    delta = 1;
    while(ask(x - delta,y) == true){
        delta *= 2;
    }

    delta /= 2;

    int m = 0;

    for(;delta;delta /= 2){
        if(ask(x - m - delta,y) == true){
            m += delta;
        }
    }

    m++;

    x -= (m / 2);
    y -= (m / 2);

    while(ask(x - m,y - m)){
        x -= m;
        y -= m;
    }

    while(ask(x - m,y)){
        x -= m;
    }

    while(ask(x,y - m)){
        y - m;
    }

    x += 2 * m;
    y += 2 * m;

    answer(x,y);

    return 0;
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:81:11: warning: statement has no effect [-Wunused-value]
         y - m;
         ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 296 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 3 ms 396 KB Incorrect
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 3 ms 248 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 3 ms 248 KB Incorrect