# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
173759 | juggernaut | 생물 실험 (IZhO13_expgorl) | C++14 | 4 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |