이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
vector <int> vx = {1, -1, 0, 0, 0, 0};
vector <int> vy = {0, 0, 1, -1, 0, 0};
vector <int> vz = {0, 0, 0, 0, 1, -1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int all, n, m, k, q;
int ansx=-1, ansy, ansz;
map <ipii, int> ma;
int que(int a, int b, int c){
if(a<=0 || a>n || b<=0 || b>m || c<=0 || c>k) return -1;
if(ma.find(ipii(pii(a, b), c)) != ma.end()) return ma[ipii(pii(a, b), c)];
if(all == q) assert(false);
cout << "? " << a << ' ' << b << ' ' << c << endl;
all++;
int x; cin >> x;
ma[ipii(pii(a, b), c)] = x;
return x;
}
signed main(){
cin >> n >> m >> k >> q;
int len = n;
int l=1, r=n, mid1=l+len*3819/10000, mid2=r-len*3819/10000;
int le = que(mid1, 1, 1), ri = que(mid2, 1, 1);
while(r-l+1 >= 10){
if(le < ri){
l = mid1;
mid1 = mid2;
le = ri;
len = r-l+1;
mid2 = r-len*3819/10000;
ri = que(mid2, 1, 1);
} else {
r = mid2;
mid2 = mid1;
ri = le;
len = r-l+1;
mid1 = r-len*3819/10000;
le = que(mid2, 1, 1);
}
}
int ans = -1;
for(int i=l-1; i<=r+1; i++){
if(que(i, 1, 1) > max(que(i-1, 1, 1), que(i+1, 1, 1))){
ans = i; break;
}
}
assert(ans != -1);
cout << "! " << ans << " 1 1" << endl;
}
# | 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... |