이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 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... |