Submission #643849

# Submission time Handle Problem Language Result Execution time Memory
643849 2022-09-23T06:13:56 Z KindaNameless Aliens (IOI07_aliens) C++14
0 / 100
2 ms 336 KB
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<numeric>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<stack>
#include<deque>
#include<cmath>
#include<map>
#include<set>
using namespace std;

#define ll long long
#define ld long double
#define int long long

int N;

bool ask(int x, int y){
    if(x <= 0 || y <= 0 || x > N || y > N)return 0;
    cout << "examine " << x << " " << y << "\n";
    string s; cin >> s;
    return s[0] == 't';
}

int check(int x, int y, int dx, int dy){
    int p = 1;
    while(ask(x + p*dx, y + p*dy)){
        p *= 2;
    }

    int l = p/2, r = p;
    while(r - l > 1){
        int m = (l + r) / 2;
        if(ask(x + m*dx, y + m*dy)){
            l = m;
        }
        else r = m;
    }

    return l;
}

signed main(){
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int x, y; cin >> N >> x >> y;

    int a, b, c, d;
    a = check(x, y, 0, -1);
    b = check(x, y, 0, 1);
    c = check(x, y, -1, 0);
    d = check(x, y, 1, 0);

    int M = a + b + 1;
    int xc = x + (M/2) - a, yc = y + (M/2) - c;

    cout << "     " << xc << " " << yc << "\n";

    a = check(xc, yc, M, M);
    b = check(xc, yc, M, -M);
    c = check(xc, yc, -M, -M);
    d = check(xc, yc, -M, M);

    if(a == 4 && b == 0 && c == 0 && d == 0){xc += 2*M; yc += 2*M;}
    if(a == 2 && b == 0 && c == 0 && d == 2){xc += 0*M; yc += 2*M;}
    if(a == 0 && b == 0 && c == 0 && d == 5){xc -= 2*M; yc += 2*M;}
    if(a == 3 && b == 1 && c == 1 && d == 1){xc += 1*M; yc += 1*M;}
    if(a == 1 && b == 1 && c == 1 && d == 3){xc -= 1*M; yc += 1*M;}

    if(a == 2 && b == 2 && c == 0 && d == 0){xc += 2*M; yc += 0*M;}
    if(a == 2 && b == 2 && c == 2 && d == 2){xc += 0*M; yc += 0*M;}
    if(a == 0 && b == 0 && c == 2 && d == 2){xc -= 2*M; yc += 0*M;}

    if(a == 1 && b == 3 && c == 1 && d == 1){xc += 1*M; yc -= 1*M;}
    if(a == 1 && b == 1 && c == 3 && d == 1){xc -= 1*M; yc -= 1*M;}
    if(a == 0 && b == 4 && c == 0 && d == 0){xc += 2*M; yc -= 2*M;}
    if(a == 0 && b == 2 && c == 2 && d == 0){xc += 0*M; yc -= 2*M;}
    if(a == 0 && b == 0 && c == 4 && d == 0){xc -= 2*M; yc -= 2*M;}

    cout << "solution " << xc << " " << yc << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 336 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -