# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
84441 | talip | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 1063 ms | 688 KiB |
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;
//Yeter calis artik
//Scanf hurmetine. Pls.
char s[10002];
int x[10001]; int y[10001];
int main(){
int lax, lay, gox, goy, n, k;
long double mini=1.0E6, maxi=0, ans;
scanf("%d %s %d %d %d %d",&k,s+1,&lax,&lay,&gox,&goy); n=strlen(s+1);
x[0]=gox-lax; y[0]=goy-lay;
for(int i=1;i<=n;i++){
x[i]=x[i-1]; y[i]=y[i-1];
switch(s[i]){
case 'L':
x[i]--;
break;
case 'R':
x[i]++;
break;
case 'F':
y[i]++;
break;
case 'B':
y[i]--;
break;
}
}
for(int i=0;i<=n;i++){
for(int j=0;j<k;j++){
ans=sqrtl(1LL*(x[i]+j*(x[n]-x[0]))*(x[i]+j*(x[n]-x[0]))+1LL*(y[i]+j*(y[n]-y[0]))*(y[i]+j*(y[n]-y[0])));
if(mini>ans){
mini=ans;
}
if(ans>maxi){
maxi=ans;
}
}
}
printf("%.14Lf %.14Lf", mini, maxi);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |