이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e6+10;
int N,M,K;
int dp[mxn];
namespace CHECK{
vector<vector<vector<int>>> v;
int ask(int x,int y = 1,int z = 1){
cout<<v[x][y][z]<<endl;
return v[x][y][z];
}
bool check(int x,int y = 1,int z = 1){
int re = v[x][y][z]>=max({v[x-1][y][z],v[x][y-1][z],v[x][y][z-1],v[x+1][y][z],v[x][y+1][z],v[x][y][z+1]});
if(!re)cerr<<"WA"<<endl;
else cerr<<"AC"<<endl;
return 0;
}
}
int C = 0;
int ask(int x,int y = 1,int z = 1){
//if(dp[x] != -1)return dp[x];
cout<<"? "<<x<<' '<<y<<' '<<z<<endl;
C++;
int re;
//re = CHECK::ask(x,y,z);
cin>>re;
if(re == -1)exit(0);
dp[x] = re;
return re;
}
int main(){
memset(dp,-1,sizeof(dp));
cin>>N>>M>>K;
CHECK::v = vector<vector<vector<int>>>(N+2,vector<vector<int>>(M+2,vector<int>(K+2,0)));
//for(int i = 1;i<=N;i++)for(int j = 1;j<=M;j++)for(int k = 1;k<=K;k++)cin>>CHECK::v[i][j][k];
int l = 1,r = N;
while(r-l>1){
int mid = (l+r)>>1;
if(ask(mid)>=ask(mid+1))r = mid;
else l = mid+1;
}
assert(r>=l&&r-l<=1);
if(l == r)cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1);
else if(ask(l)>ask(r))cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1);
else cout<<"! "<<r<<" 1 1"<<endl,CHECK::check(r,1,1);
cerr<<C<<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... |