This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
int ask(int a,int b,int c){
pf("? %d %d %d\n",a,b,c);
fflush(stdout);
int x;sf("%d",&x);
return x;
}
void submit(int a,int b,int c){
pf("! %d %d %d\n",a,b,c);
fflush(stdout);
exit(0);
}
int n,m,k,q;
mt19937 rng(time(0));
int main(){
sf("%d%d%d%d",&n,&m,&k,&q);
tuple<int,int,int,int> ans={0,0,0,0};
for(int i=0;i<q;++i){
int x=rng()%n+1,y=rng()%m+1,z=rng()%k+1;
ans=max(ans,{ask(x,y,z),x,y,z});
}
auto[_,x,y,z]=ans;
submit(x,y,z);
}
Compilation message (stderr)
worm.cpp: In function 'int ask(int, int, int)':
worm.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | int x;sf("%d",&x);
| ^
worm.cpp: In function 'int main()':
worm.cpp:24:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
24 | sf("%d%d%d%d",&n,&m,&k,&q);
| ^
# | 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... |