#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, k, q;
cin >> n >> m >> k >> q;
srand(2137);
int maks = 0;
vector<int> p = {0, 0, 0};
for (int i = 0; i < q/2; i++) {
int x = rand()%n+1, y = rand()%m+1, z = rand()%k+1;
cout << "? " << x << ' ' << y << ' ' << z << endl;
int l;
cin >> l;
if (l > maks) {
maks = l;
p = {x, y, z};
}
}
while (true) {
int s = 0;
if (p[0]>1) {
cout << "? " << p[0]-1 << ' ' << p[1] << ' ' << p[2] << endl;
int l;
cin >> l;
if (l > maks) {
p[0]--;
l = maks;
s++;
}
}
if (p[0]<n) {
cout << "? " << p[0]+1 << ' ' << p[1] << ' ' << p[2] << endl;
int l;
cin >> l;
if (l > maks) {
p[0]++;
l = maks;
s++;
}
}
if (p[1]>1) {
cout << "? " << p[0] << ' ' << p[1]-1 << ' ' << p[2] << endl;
int l;
cin >> l;
if (l > maks) {
p[1]--;
l = maks;
s++;
}
}
if (p[1]<m) {
cout << "? " << p[0] << ' ' << p[1]+1 << ' ' << p[2] << endl;
int l;
cin >> l;
if (l > maks) {
p[1]++;
l = maks;
s++;
}
}
if (p[2]>1) {
cout << "? " << p[0] << ' ' << p[1] << ' ' << p[2]-1 << endl;
int l;
cin >> l;
if (l > maks) {
p[2]--;
l = maks;
s++;
}
}
if (p[2]<k) {
cout << "? " << p[0] << ' ' << p[1] << ' ' << p[2]+1 << endl;
int l;
cin >> l;
if (l > maks) {
p[2]++;
l = maks;
s++;
}
}
if (s == 0) {
break;
}
}
cout << "! " << p[0] << ' ' << p[1] << ' ' << p[2] << 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... |