Submission #733645

# Submission time Handle Problem Language Result Execution time Memory
733645 2023-05-01T06:33:08 Z ByeWorld Worm Worries (BOI18_worm) C++14
10 / 100
1 ms 304 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define int long long
#define ll long long
using namespace std;
const int MAXN = 1e3+10;
const int LOG = 20;
const int SQRT = 4e3;
const int INF = 1e7;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;

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

int ask(int x){
    cout << "? " << x << " 1 1" << endl;
    int ret; cin >> ret;
    return ret;
}
void ans(int x){
    cout << "! " << x << " 1 1" << endl;
}

void find(int l, int r){
    while(r-l+1 >= 4){
        int mid1 = (l+l+r)/3; int mid2 = (l+r+r+2)/3;
        if(ask(mid1) < ask(mid2)){
            l = mid1;
        } else r = mid2;
    }
    int a1 = ask(l); int a2 = ask(l+1); int a3 = ask(l+2);
    if(a1 >= a2) ans(l);
    else if(a2 <= a3) ans(l+2);
    else ans(l+1);
}
signed main() {
    cin >> n >> m >> k >> q;
    find(1, n);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
# 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 Correct 1 ms 208 KB Output is correct
2 Incorrect 0 ms 208 KB not a local maximum
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Incorrect 1 ms 208 KB not a local maximum
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB not a local maximum
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB not a local maximum
3 Halted 0 ms 0 KB -