답안 #404090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
404090 2021-05-13T18:32:51 Z AugustinasJucas Aliens (IOI07_aliens) C++14
90 / 100
6 ms 268 KB
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > kampai = {{4, 5}, {4, 11}, {4, 17}, {7, 8}, {7, 14}, {10, 5}, {10, 11}, {10, 17}, {13, 8}, {13, 14}, {16, 5}, {16, 11}, {16, 17}};
vector<pair<int, int> > visi;
int n;
pair<long long, long long> daug(pair<long long, long long> a, long long x){
    return {a.first*x, a.second*x};
}
bool ask(long long x, long long y){
    if(x > n || y > n || y <= 0 || x <= 0) return false;
/*    for(auto z : visi) if(z.first == x && z.second == y) {
        cout << x << ", " << y << " = true\n";
        return true;
    }
    return false;*/
    cout << "examine " << x << " " << y  << endl; 
    string a; cin >> a;
    return a == "true";
}
pair<long long, long long> daryk(int x, int y, pair<int, int> dir){ 
    for(long long i = 30; i > -1; i--){
        long long sk = (1 << i);
        auto busiu = daug(dir, sk);
        long long px = x + busiu.first; long long py = y + busiu.second;
        if(ask(px, py)){
            x = px; y = py;
        }
    }
    return {x, y};
}
int main(){
    for(auto x : kampai){
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                visi.push_back({j + x.second, i + x.first});
//                cout << "dedu " << j + x.second << "; " << i + x.first << endl;
            }
        }
    }
    int x, y; cin >> n >> x >> y;
    pair<int, int> st = {x, y};
    for(int i = 0; i < 3; i++){
        st = daryk(st.first, st.second, make_pair(-1, 0));
    }
    for(int i = 0; i < 3; i++){
        st = daryk(st.first, st.second, make_pair(0, 1));
    }
    x = st.first; y = st.second;
//    cout << "X = " <<x << ", Y = " << y << endl;
    auto prm = daryk(st.first, st.second, make_pair(-1, -1));
    auto ant = daryk(st.first, st.second, make_pair(1, 1));
    x = (prm.first + ant.first) / 2;;;
    y = (prm.second + ant.second) / 2ll;
    prm = daryk(st.first, st.second, make_pair(1, -1));
    ant = daryk(st.first, st.second, make_pair(-1, 1));
    x = (prm.first + ant.first) / 2ll;
    y = (prm.second + ant.second) / 2ll;

    cout <<"solution " <<  x << " " << y;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 268 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 6 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Runtime error 4 ms 200 KB Execution killed with signal 13