Submission #891214

# Submission time Handle Problem Language Result Execution time Memory
891214 2023-12-22T12:21:21 Z Dec0Dedd Love Polygon (BOI18_polygon) C++14
0 / 100
1 ms 604 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<string, string> pii;

const int N = 1e6+10;

int a[N], n, m, k, q;

int ask(int x, int y, int z) {
    cout<<"? "<<x<<" "<<y<<" "<<z<<endl;
    int p; cin>>p;
    return p;
}

void solve() {
    cin>>n>>m>>k>>q;
    assert(m == k && m == 1);

    int l=1, r=n;
    while (l <= r) {
        int md=(l+r)/2;

        int vl=ask(md, 1, 1), lv=0, rv=0;
        if (md == 1) rv=ask(md+1, 1, 1);
        else if (md == n) lv=ask(md-1, 1, 1);
        else lv=ask(md-1, 1, 1), rv=ask(md+1, 1, 1);

        if (vl >= lv && vl >= rv) {
            cout<<"! "<<md<<endl;
            return;
        }

        if (lv > vl) r=md-1;
        else l=md+1;
    } assert(false);
}

int main() {
    int t=1;
    while (t--) solve();
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -