Submission #404128

# Submission time Handle Problem Language Result Execution time Memory
404128 2021-05-13T20:19:05 Z AugustinasJucas Aliens (IOI07_aliens) C++14
90 / 100
4 ms 228 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};
    auto bs = daryk(st.first, st.second, make_pair(-1, 1));
    if(ask(bs.first - 1, bs.second)){ // reiks eiti i kaire
        for(int j = 0; j < 3; j++) bs = daryk(bs.first, bs.second, make_pair(0, 1));
    }else if(ask(bs.first, bs.second + 1)){
        for(int j = 0; j < 3; j++) bs = daryk(bs.first, bs.second, make_pair(-1, 0));
    }
    x = bs.first; y = bs.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) / 2ll;
    y = (prm.second + ant.second) / 2ll;
    st = {x, y};
    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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Incorrect 4 ms 200 KB Incorrect