이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef double db;
typedef long long LL;
int get(){
char ch;
while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
if (ch=='-'){
int s=0;
while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
return -s;
}
int s=ch-'0';
while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
return s;
}
typedef unsigned int ui;
ui seed;
ui getrand(){seed^=seed<<13;seed^=seed>>17;seed^=seed<<5;return seed;}
int fx[6][3]={{0,0,-1},{0,0,1},{1,0,0},{-1,0,0},{0,1,0},{0,-1,0}};
int main(){
int n=get(),m=get(),k=get();
int q=get();
seed=845125457;
int x,y,z,val=-1;
fo(i,1,q/2){
int px=getrand()%n+1,py=getrand()%m+1,pz=getrand()%k+1;
printf("? %d %d %d\n",px,py,pz);
fflush(stdout);
int ret=0;
scanf("%d",&ret);
if (val<ret){
x=px,y=py,z=pz;
val=ret;
}
}
for(;1;){
bool cg=0;
fo(t,0,5){
int px=x+fx[t][0],py=y+fx[t][1],pz=z+fx[t][2];
int ret=0;
if (px<1||py<1||pz<1||px>n||py>m||pz>k)ret=0;
else{
printf("? %d %d %d\n",px,py,pz);
fflush(stdout);
scanf("%d",&ret);
}
if (ret>val){
x=px,y=py,z=pz;
val=ret;
cg=1;
break;
}
}
if (!cg)break;
}
printf("! %d %d %d\n",x,y,z);
fflush(stdout);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
worm.cpp: In function 'int main()':
worm.cpp:41:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&ret);
~~~~~^~~~~~~~~~~
worm.cpp:56:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&ret);
~~~~~^~~~~~~~~~~
# | 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... |