This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rng(time(nullptr));
int ask(int a){
cout << "? " << a << " " << 1 << " " << 1 << endl;
int x; cin >> x;
return x;
}
int main(){
int N, M, K, Q; cin >> N >> M >> K >> Q;
vector <int> v(N+1, -1);
v[0] = 0; v[N] = 0;
int s = 1, e = N+1, m;
while (e > s){
m = (e+s)/2;
int a = v[m-1], b = v[m], c = v[m+1];
if (a == -1)ask(a);
if (b == -1)ask(b);
if (c == -1)ask(c);
if (b >= a && b >= c){
cout << "! " << m << " " << 1 << " " << 1 << endl;
return 0;
}
else if (a > b)e = m;
else s = m+1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |