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 <iostream>
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
int N, Q, K, M;
map<int, int> mp;
int ask(int x) {
if(mp.count(x)) return mp[x];
cout << "? " << x << " 1 1" << endl;
int h;
cin >> h;
return mp[x] = h;
}
int main() {
cin >> N >> M >> K >> Q;
int left = 1, right = N;
while (left < right) {
int mid = (left + right) / 2;
int h1 = ask(mid);
int h2 = ask(mid + 1);
if (h1 > h2) {
right = mid;
} else {
left = mid + 1;
}
}
cout << "! " << left << " 1 1" << endl;
return 0;
}
# | 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... |