#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
using namespace std;
double n;
double a1,b1,a2,b2;
double dis1;
void dis(){
double a=(a1-a2)*(a1-a2);
double b=(b1-b2)*(b1-b2);
dis1=sqrt(a+b);
}
int main(){
cin>>n;
string s;
cin>>s;
int m=s.size();
cin>>a1>>b1>>a2>>b2;
double mn=INT_MAX,mx=-INT_MAX;
for(int i=1;i<=n;i++){
for(int k=0;k<m;k++){
dis();
if(mx<dis1)
mx=dis1;
if(mn>dis1)
mn=dis1;
if(s[k]=='L')
a2--;
if(s[k]=='R')
a2++;
if(s[k]=='F')
b2++;
if(s[k]=='B')
b2--;
/* if(s[k]=='I'){
cout<<fixed;
cout<<setprecision(12)<<mn<<' ';
cout<<setprecision(12)<<mx;
return 0;
}*/
}
}
dis();
if(mx<dis1)
mx=dis1;
if(mn>dis1)
mn=dis1;
cout<<fixed;
cout<<setprecision(12)<<mn<<' ';
cout<<setprecision(12)<<mx;
//cout<<fixed;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
165 ms |
376 KB |
Output is correct |
2 |
Correct |
260 ms |
380 KB |
Output is correct |
3 |
Correct |
309 ms |
492 KB |
Output is correct |
4 |
Correct |
338 ms |
640 KB |
Output is correct |
5 |
Correct |
132 ms |
652 KB |
Output is correct |
6 |
Correct |
219 ms |
672 KB |
Output is correct |
7 |
Correct |
274 ms |
672 KB |
Output is correct |
8 |
Correct |
395 ms |
844 KB |
Output is correct |
9 |
Execution timed out |
1046 ms |
844 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |