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;
map<array<int, 3>, int> M;
int query_cnt = 0;
int query(int a, int b, int c) {
if(M.count({a, b, c})) return M[{a, b, c}];
query_cnt++;
cout << "? " << a << ' ' << b << ' ' << c << endl;
int d;
cin >> d;
M[{a, b, c}] = d;
return d;
}
void answer(int a, int b, int c) {
cout << "! " << a << ' ' << b << ' ' << c << endl;
return;
}
void subtask_12() {
int N = 1000000;
int s = 1, e = N;
while(s<=e) {
if(s==e) {
answer(s, 1, 1);
return;
}
if(s+1==e) {
if(query(s, 1, 1) >= query(e, 1, 1)) {
answer(s, 1, 1);
return;
}
else {
answer(e, 1, 1);
return;
}
}
int mid = (s + e) / 2;
if(query(mid, 1, 1) > query(mid+1, 1, 1)) {
s = mid + 1;
}
else {
e = mid;
}
}
}
void subtask_34() {
}
void subtask_56() {
}
signed main() {
int N, M, K, Q;
cin >> N >> M >> K >> Q;
if(M==1 && K == 1 && N == 1000000) {
subtask_12();
}
if(K==1 && N==M) {
subtask_34();
}
if(K==N && K==M) {
subtask_56();
}
//cout << query_cnt;
}
# | 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... |