#include "bits/stdc++.h"
using namespace std;
#define INF 2000000000
#define INFLL 3000000000000000000LL
#define ll long long
int main() {
cin.tie(0)->sync_with_stdio(0);
int n,m,k,q;
cin>>n>>m>>k>>q;
map<pair<int,pair<int,int>>,int>mp;
bool b=1;
int x=1;
int y=1;
int z=1;
cout<<"? 1 1 1";
int h;
cin>>h;
while(q--&&b){
b=0;
int x_1=mp[{x-1,{y,z}}];
int x_2=mp[{x+1,{y,z}}];
int y_1=mp[{x,{y-1,z}}];
int y_2=mp[{x,{y+1,z}}];
int z_1=mp[{x,{y,z-1}}];
int z_2=mp[{x,{y,z+1}}];
if(x_1==0&&x>1){
cout<<"? "<<x-1<<" "<<y<<" "<<z<<"\n";
cin>>x_1;
mp[{x-1,{y,z}}]=x_1;
}
if(x_1==0&&x<n-1){
cout<<"? "<<x+1<<" "<<y<<" "<<z<<"\n";
cin>>x_2;
mp[{x+1,{y,z}}]=x_2;
}
if(y_1==0&&x>1){
cout<<"? "<<x<<" "<<y-1<<" "<<z<<"\n";
cin>>y_1;
mp[{x,{y-1,z}}]=y_1;
}
if(y_1==0&&x<m-1){
cout<<"? "<<x<<" "<<y+1<<" "<<z<<"\n";
cin>>y_2;
mp[{x,{y+1,z}}]=y_2;
}
if(z_1==0&&x>1){
cout<<"? "<<x<<" "<<y<<" "<<z-1<<"\n";
cin>>z_1;
mp[{x,{y,z-1}}]=z_1;
}
if(z_1==0&&x<k-1){
cout<<"? "<<x<<" "<<y<<" "<<z+1<<"\n";
cin>>z_2;
mp[{x,{y,z+1}}]=z_2;
}
if(h<x_1){
h=x_1;
x--;
b=1;
}
else if(h<x_2){
h=x_2;
x++;
b=1;
}
else if(h<y_1){
h=y_1;
y--;
b=1;
}
else if(h<y_2){
h=y_2;
y++;
b=1;
}
else if(h<z_1){
h=z_1;
z--;
b=1;
}
else if(h<z_2){
h=z_2;
z++;
b=1;
}
}
cout<<"! "<<x<<" "<<y<<" "<<z<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |