#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
200040 KB |
Output is correct |
2 |
Correct |
163 ms |
200036 KB |
Output is correct |
3 |
Incorrect |
162 ms |
200036 KB |
not a local maximum |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
163 ms |
199892 KB |
too many queries. input: ? 985999 1 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6600 KB |
Output is correct |
2 |
Incorrect |
3 ms |
6600 KB |
not a local maximum |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
59428 KB |
Output is correct |
2 |
Correct |
50 ms |
59428 KB |
Output is correct |
3 |
Correct |
50 ms |
59432 KB |
Output is correct |
4 |
Incorrect |
52 ms |
59432 KB |
not a local maximum |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
8876 KB |
Output is correct |
2 |
Incorrect |
3 ms |
8884 KB |
not a local maximum |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
199 ms |
508396 KB |
Output is correct |
2 |
Incorrect |
184 ms |
508368 KB |
not a local maximum |
3 |
Halted |
0 ms |
0 KB |
- |