제출 #391628

#제출 시각아이디문제언어결과실행 시간메모리
391628VictorWorm Worries (BOI18_worm)C++17
0 / 100
258 ms500332 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...