제출 #385287

#제출 시각아이디문제언어결과실행 시간메모리
385287mohamedsobhi777Worm Worries (BOI18_worm)C++14
0 / 100
1605 ms19940 KiB
#include <bits/stdc++.h> using namespace std; #define vi vector<int> #define vll vector<ll> #define vii vector<pair<int, int>> #define pii pair<int, int> #define pll pair<ll, ll> #define loop(_) for (int __ = 0; __ < (_); ++__) #define pb push_back #define f first #define s second #define sz(_) ((int)_.size()) #define all(_) _.begin(), _.end() #define lb lower_bound #define ub upper_bound using ll = long long; using ld = long double; const int N = 1e5 + 7; const ll mod = 1e9 + 7; int n, m, k, q; map<array<int, 3>, int> dp; int guess(int x, int y, int z) { if (x < 1 || x > n || y < 1 || y > m || z < 1 || z > k) return 0; if (dp.count({x, y, z})) return dp[{x, y, z}]; --q; cout << "? " << x << " " << y << " " << z << endl; cout << flush; int ret; cin >> ret; return dp[{x, y, z}] = ret; } void Answer(int x, int y, int z) { cout << "! " << x << " " << y << " " << z << endl; cout << flush; exit(0); } int rnd(int x, int y) { return x + rand() % (y - x + 1); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE // freopen("in.in", "r", stdin); #endif srand(time(0)); cin >> n >> m >> k >> q; while (q >= 3) { int x = rnd(1, n), y = rnd(1, m), z = rnd(1, k); int mg = guess(x, y, z); bool flag = 1; for (int a = -1; a <= 1; ++a) { for (int b = -1; b <= 1; ++b) { for (int c = -1; c <= 1; ++c) { if (abs(a) + abs(b) + abs(c) != 1 || !flag) continue; flag &= (mg >= guess(x + a, y + b, z + c)); } } } if (flag) Answer(x, y, z); } assert(0); 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...