Submission #391642

#TimeUsernameProblemLanguageResultExecution timeMemory
391642VictorWorm Worries (BOI18_worm)C++17
10 / 100
264 ms500328 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 (y == 1 && z == 1) { vi arr(x + 2, 0); arr[0] = arr[x + 1] = 1; int lo = 1, hi = x; while (true) { if (lo == hi) { cout << "! " << lo << " 1 1" << endl; break; } int l = lo + (hi - lo + 1) / 3, n1, n2, n3; if (arr[l - 1]) n1 = arr[l - 1]; else { cout << "? " << l - 1 << " 1 1" << endl; cin >> n1; } if (arr[l]) n2 = arr[l]; else { cout << "? " << l << " 1 1" << endl; cin >> n2; } if (arr[l + 1]) n3 = arr[l + 1]; else { cout << "? " << l + 1 << " 1 1" << endl; cin >> n3; } arr[l - 1] = n1; arr[l] = n2; arr[l + 1] = n3; if (n1 <= n2 && n3 <= n2) { cout << "! " << l << " 1 1" << endl; break; } else if (n2 < n3) lo = l + 1; else hi = l - 1; } } }
#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...