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;
int n, m, k, q;
map <tuple <int, int, int>, int> mem;
int query(int x, int y, int z) {
if(mem.find(make_tuple(x, y, z)) != mem.end()) return mem[make_tuple(x, y, z)];
cout << "? " << x << " " << y << " " << z << endl;
int ans;
cin >> ans;
if(ans == -1) exit(0);
return mem[make_tuple(x, y, z)] = ans;
}
/* this function solves the m = k = 1 case */
int search(int b, int e) {
if(b == e) {
return b;
}
int m = (b + e) >> 1;
if(query(m, 1, 1) < query(m + 1, 1, 1)) return search(m + 1, e);
else return search(b, m);
}
int main() {
cin >> n >> m >> k >> q;
assert(k == 1 && m == 1);
int ans = search(1, n);
cout << "! " << ans << " 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... |