제출 #173759

#제출 시각아이디문제언어결과실행 시간메모리
173759juggernaut생물 실험 (IZhO13_expgorl)C++14
100 / 100
4 ms384 KiB
#include<stdio.h> #include<math.h> #include<string.h> #include<algorithm> using namespace std; #define change(x) ((x)!='L'?(x)!='R'?(x)!='F'?3:2:1:0) char ch[10010]; int K,sx,sy; double ans[2] = {1e9+1e5,0}; int xx[4] = {-1,1,0,0}, yy[4] = {0,0,1,-1}; int itx,ity; inline double dis(int x,int y){return sqrt(1.*x*x+1.*y*y);} int main(){ scanf("%d %s",&K,ch); int x,y; scanf("%d%d%d%d",&x,&y,&sx,&sy); sx-=x,sy-=y; for(int i=0;ch[i];i++){ if(ch[i] == 'I')continue; int tmp = change(ch[i]); itx += xx[tmp], ity += yy[tmp]; } for(int i=0;!i||ch[i-1];i++){ if(ch[i] == 'I')continue; int st = 0, en = K-1, a, b; while(st<=en){ a = (st+en)>>1; double b = dis(sx + itx * a, sy + ity * a); double c = dis(sx + itx * (a+1), sy + ity * (a+1)); if(b<c)en = a-1; else st = a+1; ans[0] = min(ans[0], b); ans[0] = min(ans[0], c); } ans[1] = max(ans[1],dis(sx,sy)); ans[1] = max(ans[1],dis(sx + itx * (K-1), sy + ity * (K-1))); int tmp = change(ch[i]); sx += xx[tmp], sy += yy[tmp]; } printf("%.10f %.10f",ans[0],ans[1]); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

expgorl.cpp: In function 'int main()':
expgorl.cpp:29:28: warning: unused variable 'b' [-Wunused-variable]
   int st = 0, en = K-1, a, b;
                            ^
expgorl.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %s",&K,ch);
  ~~~~~^~~~~~~~~~~~~~~
expgorl.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d",&x,&y,&sx,&sy);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...