#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int ask(int i){
cout << "? " << i << " " << 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, m;
while (e >= s){
m = (e+s)/2;
if (s == e){cout << "! " << m << " " << 1 << " " << 1 << endl; return 0;}
int a = v[m], b = v[m+1];
if (a == -1){a = ask(m); v[m] = a;}
if (b == -1){b = ask(m+1); v[m+1] = b;}
if (a >= b)e = m;
else s = m+1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4176 KB |
not a local maximum |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
4176 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
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 |
- |
# |
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 |
- |