이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// trans rights
#include <bits/extc++.h>
using namespace std;
using ll = long long;
int N, M, K, Q;
map<tuple<int, int, int>, int> mp;
int H(int x, int y = 1, int z = 1)
{
if (x < 1 or x > N)
return 0;
if (y < 1 or y > M)
return 0;
if (z < 1 or z > K)
return 0;
if (mp[{x, y, z}])
return mp[{x, y, z}];
cout << "? " << x << ' ' << y << ' ' << z << endl;
int h;
cin >> h;
return mp[{x, y, z}] = h;
}
int main(int argc, const char *argv[])
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> M >> K >> Q;
int a = 1, b = N + 1;
while (b - a > 1)
{
int m = (a + b) / 2;
int m1 = (a + m) / 2;
int m2 = (m + b) / 2;
if (rand() & 1)
{
if (H(m1) >= H(m))
{
b = m;
} else if (H(m2) >= H(m)) {
a = m;
} else {
a = m1;
b = m2;
}
}else{
if (H(m2) >= H(m))
{
a = m;
} else if (H(m1) >= H(m)) {
b = m;
} else {
a = m1;
b = m2;
}
}
}
cout << "! " << a << ' ' << 1 << ' ' << 1;
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... |