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;
const int N = 1e6 + 3;
int n, m, k, q;
int arr[N];
int query(int x){
if(arr[x]) return arr[x];
cout << "? " << x << " " << 1 << " " << 1 << "\n";
cout.flush();
cin >> arr[x];
return arr[x];
}
void answer(int x){
cout << "! " << x << " " << 1 << " " << 1 << "\n";
cout.flush();
exit(0);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m >> k >> q;
int l = 1, r = n;
while(l != r){
int mid1 = (l + r) >> 1;
int mid2 = mid1 + 1;
int a = query(mid1), b = query(mid2);
if(a >= b) r = mid1;
else l = mid2;
}
answer(l);
}
# | 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... |