제출 #121725

#제출 시각아이디문제언어결과실행 시간메모리
121725samjia2000Worm Worries (BOI18_worm)C++14
59 / 100
721 ms388 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...