이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define rep(n) for (int i = 0; i < n; ++i)
#define rep2(n) for (int j = 0; j < n; ++j)
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
array<int, 3> max_id (int i, int j1, int k1, int j2, int k2) {
int ma = 0, cur, idj = j1, idk = k2;
for (int j = j1; j <= j2; ++j) {
for (int k = k1; k <+ k2; ++k) {
cout << "? " << i << " " << j << " " << k << "\n" << flush;
cin >> cur;
if (cur>ma) {
ma = cur;
idj = j, idk = k;
}
}
}
return {i, idj, idk};
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, k, q;
cin >> n >> m >> k >> q;
int lo = 1, hi = n;
while (lo<hi) {
int mid = (lo+hi)/2, l = 0, a = 0, r = 0;
array<int, 3> id = max_id(mid, 1, 1, m, k);
if (mid>1) {
cout << "? " << id[0]-1 << " " << id[1] << " " << id[2] << "\n" << flush;
cin >> l;
}
cout << "? " << id[0] << " " << id[1] << " " << id[2] << "\n" << flush;
cin >> a;
if (mid<n) {
cout << "? " << id[0]+1 << " " << id[1] << " " << id[2] << "\n" << flush;
cin >> r;
}
if (a>=l&&a>=r) {
cout << "! " << id[0] << " " << id[1] << " " << id[2] << "\n" << flush;
break;
}
else if (l>r) hi = mid-1;
else lo = mid+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... |