Submission #723749

#TimeUsernameProblemLanguageResultExecution timeMemory
723749Mr_HusanboyWorm Worries (BOI18_worm)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; int max_Q; int n, m, k; int cnt_q = 0; #ifdef LOCAL vector<vector<vector<int>>> mat; #endif int ask(int x, int y, int z) { cout << "? " << x << ' ' << y << ' ' << z << endl; int ans = -1; #ifdef LOCAL cnt_q ++; if(x > n || y > m || z > k || cnt_q > max_Q){ ans = -1; }else{ ans = mat[x - 1][y - 1][z - 1]; } #else cin >> ans; #endif if (ans == -1) exit(0); return ans; } __attribute__((noreturn)) void guess(int x, int y, int z) { cout << "! " << x << ' ' << y << ' ' << z; cout << endl; exit(0); } mt19937 mt(); void sub1(int &n){ int l = 1, r = n; while(l < r){ int m = (l + r) >> 1; if(l == r){ guess(l, 1, 1); } int h = ask(m + 1, 1, 1); int hh = ask(m, 1, 1); if(l == r - 1){ if(h > hh){ guess(m + 1, 1, 1); }else{ guess(m, 1, 1); } } if(h >= hh){ l = m + 1; }else{ r = m; } } } void solve(){ cin >> n >> m >> k; cin >> max_Q; #ifdef LOCAL mat.assign(n, vector(m, vector(k, 0))); for(int i = 0; i < n; i ++){ for(int j = 0; j < m; j ++){ for(int ii = 0; ii < k; ii ++){ cin >> mat[i][j][ii]; } } } #endif sub1(n); } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int testcases = 1; while(testcases --){ solve(); if(testcases) cout << '\n'; #ifdef LOCAL else cout << '\n'; cout << "__________________________" << endl; #endif } 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...