#include<bits/stdc++.h>
using namespace std;
long long n,gx,gy,lx,ly;
string pu;
double mi,ma,tr;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n;
cin>>pu;
cin>>lx>>ly>>gx>>gy;
mi= INT_MAX;
ma=0;
for(int i = 0; i<n; i++){
for(char e: pu){
if(e=='L'){
gx-=1;
}
else if(e=='R'){
gx+=1;
}
else if(e=='F'){
gy+=1;
}
else if(e=='B'){
gy-=1;
}
else if(e=='I'){
continue;
}
tr=sqrt(abs(lx-gx)*abs(lx-gx) +abs(ly-gy)*abs(ly-gy));
if(tr<mi) mi = tr;
if(tr>ma) ma = tr;
}
}
cout<<fixed;
cout<<setprecision(12);
cout<<mi<<' '<<ma;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
344 KB |
Output is correct |
2 |
Correct |
74 ms |
428 KB |
Output is correct |
3 |
Correct |
92 ms |
432 KB |
Output is correct |
4 |
Correct |
102 ms |
428 KB |
Output is correct |
5 |
Correct |
47 ms |
428 KB |
Output is correct |
6 |
Correct |
69 ms |
348 KB |
Output is correct |
7 |
Correct |
73 ms |
600 KB |
Output is correct |
8 |
Correct |
100 ms |
348 KB |
Output is correct |
9 |
Execution timed out |
1044 ms |
344 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |