#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(),a.end()
#define rep(a,b) for(int a = 0;a<b;a++)
const int inf = 1e9;
const ll infl = 1e18;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int los(int a,int b)
{
return rng()%(b-a+1)+a;
}
int main()
{
int n,m,k,q;
cin>>n>>m>>k>>q;
vector<int> mx(3);
int mxmx = 0;
int ccc = 0;
rep(i,q/2)
{
int a = los(1,n), b = los(1,m), c = los(1,k);
cout<<"?"<<" "<<a<<" "<<b<<" "<<c<<" "<<endl;
int cc;
cin>>cc;
if(cc == -1)
{
return 0;
}
ccc++;
if(cc > mxmx)
{
mxmx = cc;
mx = {a,b,c};
}
if(i > 0) return 0;
}
cout<<"!"<<" "<<1<<" "<<1<<" "<<1<<endl;
return 0;
while(true)
{
if(mx[0] != 1)
{
cout<<"?"<<" "<<mx[0]-1<<" "<<mx[1]<<" "<<mx[2]<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[0]--;
continue;
}
}
if(mx[0] != n)
{
cout<<"?"<<" "<<mx[0]+1<<" "<<mx[1]<<" "<<mx[2]<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[0]++;
continue;
}
}
if(mx[1] != 1)
{
cout<<"?"<<" "<<mx[0]<<" "<<mx[1]-1<<" "<<mx[2]<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[1]--;
continue;
}
}
if(mx[1] != m)
{
cout<<"?"<<" "<<mx[0]<<" "<<mx[1]+1<<" "<<mx[2]<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[1]++;
continue;
}
}
if(mx[2] != 1)
{
cout<<"?"<<" "<<mx[0]<<" "<<mx[1]<<" "<<mx[2]-1<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[2]--;
continue;
}
}
if(mx[2] != k)
{
cout<<"?"<<" "<<mx[0]<<" "<<mx[1]<<" "<<mx[2]+1<<" "<<endl;
int cc;
cin>>cc;
if(cc > mxmx)
{
mxmx = cc;
mx[2]++;
continue;
}
}
break;
}
cout<<"!"<<" "<<mx[0]<<" "<<mx[1]<<" "<<mx[2]<<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... |