Submission #896632

# Submission time Handle Problem Language Result Execution time Memory
896632 2024-01-01T19:42:26 Z Nonoze Aliens (IOI07_aliens) C++17
0 / 100
1 ms 472 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define sz(x) (int)(x.size())

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
  int,
  null_type,
  less<int>,
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;

int n, k, m;
vector<int> a;
map<pair<int, int>, bool> check;

bool query(int x, int y) {
    if (check.count({x, y})) return check[{x, y}];
    cout << "examine " << x << " " << y << endl;
    string ans; cin >> ans;
    if (ans=="true") return check[{x, y}]=true;
    else return check[{x, y}]=false;
}

void solve() {
    cin >> n;
    int x, y; cin >> x >> y;
    check[{x, y}]=true;
    int tempx=x, tempy=y;
    int ajout=1;
    while (tempx+ajout<=n && query(tempx+ajout, y)) {
        ajout*=2;
    }
    tempx+=ajout/2;
    ajout=ajout/2;
    ajout=min(ajout, n-tempx);
    int l=tempx, r=min(x+ajout, n);
    int rx=l;
    while (l<=r) {
        int mid=l+(r-l)/2;
        if (query(mid, y)) {
            rx=mid;
            l=mid+1;
        } else {
            r=mid-1;
        }
    }


    tempx=x, ajout=1;
    while (tempx-ajout>0 && query(tempx-ajout, y)) {
        ajout*=2;
    }
    tempx-=ajout/2;
    ajout=ajout/2;
    ajout=max(ajout, tempx);
    l=tempx, r=max(x-ajout, 1LL);
    int lx=l;
    while (l<=r) {
        int mid=l+(r-l)/2;
        if (query(mid, y)) {
            rx=mid;
            r=mid-1;
        } else {
            l=mid+1;
        }
    }

    m=rx-lx+1;

    ajout=1;
    while (tempy+ajout<=n && query(x, tempy+ajout)) {
        ajout*=2;
    }
    tempy+=ajout/2;
    ajout=ajout/2;
    ajout=min(ajout, n-tempy);
    l=tempy, r=min(y+ajout, n);
    int ry=l;
    while (l<=r) {
        int mid=l+(r-l)/2;
        if (query(x, mid)) {
            ry=mid;
            l=mid+1;
        } else {
            r=mid-1;
        }
    }
    int ly=ry-m+1;
    
    int midx=lx+m/2, midy=ly+m/2;

    while (midx+2*m<=n && query(midx+2*m, midy)) {
        midx+=2*m;
    }

    while (midy+2*m<=n && query(midx, midy+2*m)) {
        midy+=2*m;
    }

    cout << "solution " << midx-2*m << " " << midy-2*m << endl;

    return;
}


signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt=1;// cin >> tt;
    while(tt--) solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 472 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 452 KB Incorrect
2 Halted 0 ms 0 KB -