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;
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define per(i, a, b) for (int i = b - 1; i >= a; --i)
#define trax(a, x) for (auto& a : x)
#define sz(a) a.size()
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
vector<vvi> grid;
int x, y, z, q;
bool check(int a, int b, int c) {
int val = grid[a][b][c];
if (a && val < grid[a - 1][b][c]) return 0;
if (a + 1 < x && val < grid[a + 1][b][c]) return 0;
if (b && val < grid[a][b - 1][c]) return 0;
if (b + 1 < y && val < grid[a][b + 1][c]) return 0;
if (c && val < grid[a][b][c - 1]) return 0;
if (c + 1 < z && val < grid[a][b][c + 1]) return 0;
return 1;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> x >> y >> z >> q;
grid.resize(x, vvi(y, vi(z)));
if (x * y * z == q) {
rep(i, 0, x) rep(j, 0, y) rep(k, 0, z) {
cout << "? " << i + 1 << ' ' << j + 1 << ' ' << k + 1 << endl;
cin >> grid[i][j][k];
}
rep(i, 0, x) rep(j, 0, y) rep(k, 0, z) {
if(check(i,j,k)){
cout<<"! "<<i+1<<' '<<j+1<<' '<<k+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... |