이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int max_Q;
int n, m, k;
int cnt_q = 0;
#ifdef LOCAL
vector<vector<vector<int>>> mat;
#endif
int ask(int x, int y, int z) {
cout << "? " << x << ' ' << y << ' ' << z << endl;
int ans = -1;
#ifdef LOCAL
cnt_q ++;
if(x > n || y > m || z > k || cnt_q > max_Q){
ans = -1;
}else{
ans = mat[x - 1][y - 1][z - 1];
}
#else
cin >> ans;
#endif
if (ans == -1) exit(0);
return ans;
}
__attribute__((noreturn))
void guess(int x, int y, int z) {
cout << "! " << x << ' ' << y << ' ' << z;
cout << endl;
exit(0);
}
mt19937 mt();
void sub1(int &n){
int l = 1, r = n;
while(l < r){
int m = (l + r) >> 1;
if(l == r){
guess(l, 1, 1);
}
int h = ask(m + 1, 1, 1);
int hh = ask(m, 1, 1);
if(l == r - 1){
if(h > hh){
guess(m + 1, 1, 1);
}else{
guess(m, 1, 1);
}
}
if(h >= hh){
l = m + 1;
}else{
r = m;
}
}
}
void solve(){
cin >> n >> m >> k;
cin >> max_Q;
#ifdef LOCAL
mat.assign(n, vector(m, vector(k, 0)));
for(int i = 0; i < n; i ++){
for(int j = 0; j < m; j ++){
for(int ii = 0; ii < k; ii ++){
cin >> mat[i][j][ii];
}
}
}
#endif
sub1(n);
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int testcases = 1;
while(testcases --){
solve();
if(testcases) cout << '\n';
#ifdef LOCAL
else cout << '\n';
cout << "__________________________" << endl;
#endif
}
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... |