Submission #122518

# Submission time Handle Problem Language Result Execution time Memory
122518 2019-06-28T13:41:02 Z Osama_Alkhodairy Aliens (IOI07_aliens) C++17
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, x, y;

bool ask(int row, int col){
    if(row < 1 || row > n || col < 1 || col > n) return 0;
    cout << "examine " << row << " " << col << endl;
    string ret;
    cin >> ret;
    return ret == "true";
}
void answer(int row, int col){
    cout << "solution " << row << " " << col << endl;
}
int findup(int row, int col){
    int l = 1, r = row;
    while(l <= r){
        int mid = (l + r) / 2;
        if(ask(mid, col)) r = mid - 1;
        else l = mid + 1;
    }
    return l;
}
int findleft(int row, int col){
    int l = 1, r = col;
    while(l <= r){
        int mid = (l + r) / 2;
        if(ask(mid, row)) r = mid - 1;
        else l = mid + 1;
    }
    return l;
}
int finddown(int row, int col){
    int l = row, r = n;
    while(l <= r){
        int mid = (l + r) / 2;
        if(ask(mid, col)) l = mid + 1;
        else r = mid - 1;
    }
    return r;
}
int check(int m, int x, int y){
    int ret = 0;
    for(int i = -5 ; i <= 5 ; i++){
        for(int j = -5 ; j <= 5 ; j++){
            ret += ask(x + i * m, y + j * m);
        }
    }
    return ret == 13;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> x >> y;
    while(ask(x + 1, y)) x = finddown(x, y);
    int h = findup(x, y);
    int m = x - h + 1;
    x = h;
    if(m % 3 == 0 && check(m / 3, x, y)) m /= 3;
    else if(m % 5 == 0 && check(m / 5, x, y)) m /= 5;
    y = findleft(x, y);
    for(int i = -5 ; i <= 5 ; i++){
        for(int j = -5 ; j <= 5 ; j++){
            if(ask(x + i * m, y + j * m)){
                x += i * m;
                y += j * m;
                i = 6;
                break;
            }
        }
    }
    answer(x + 2 * m + m / 2, y + 2 * m + m / 2);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Incorrect 3 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Incorrect
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 4 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -