This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
int guess(int x, int y, int z)
{
if (x < 1 || x > n || y < 1 || y > m || z < 1 || z > k)
return 0;
--q;
cout << "? " << x << " " << y << " " << z << endl;
cout << flush;
int ret;
cin >> ret;
return ret;
}
void Answer(int x, int y, int z)
{
cout << "! " << x << " " << y << " " << z << endl;
cout << flush;
exit(0);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
#endif
cin >> n >> m >> k >> q;
while (q >= 3)
{
int x = 1, y = 1, z = rand() % k + 1;
int mg = guess(x, y, z);
if (mg >= guess(x, y, z - 1) && mg >= guess(x, y, z + 1))
{
Answer(x, y, z);
}
}
assert(0);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |