Submission #1093699

#TimeUsernameProblemLanguageResultExecution timeMemory
1093699MateiKing80Worm Worries (BOI18_worm)C++17
0 / 100
1142 ms20108 KiB
#include <bits/stdc++.h> using namespace std; struct cell { int x, y, z; }; bool operator <(cell a, cell b) { if(a.x != b.x) return a.x < b.x; if(a.y != b.y) return a.y < b.y; return a.z < b.z; } cell operator +(cell a, cell b) { return {a.x + b.x, a.y + b.y, a.z + b.z}; } cell nv[6] = {{0, 0, 1}, {0, 0, -1}, {0, 1, 0}, {0, -1, 0}, {1, 0, 0}, {-1, 0, 0}}; map<cell, int> mp; int n, m, k, q; int ask(cell x) { if(x.x <= 0 || x.x > n || x.y <= 0 || x.y > m || x.z <= 0 || x.z > k) return 0; if(mp[x] != 0) return mp[x]; cout << "? " << x.x << " " << x.y << " " << x.z << endl; int ans = 0; cin >> ans; mp[x] = ans; return ans; } void respond(cell x) { cout << "! " << x.x << " " << x.y << " " << x.z << endl; exit(0); } void dfs(cell x) { for(auto i : nv) if(ask(x) < ask(i + x)) dfs(i + x); respond(x); } int main() { cin >> n >> m >> k >> q; cell x = {1, 1, 1}; dfs(x); }
#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...