#include<bits/stdc++.h>
using namespace std;
long long n,gx,gy,lx,ly;
string pu,u;
long double mi,ma,tr;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n;
cin>>pu;
for(int i = 0; i<n; i++){
u+=pu;
}
cin>>lx>>ly>>gx>>gy;
mi= LLONG_MAX;
ma=0;
for(auto e: u){
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>ma) ma = tr;
if(tr<mi) mi = tr;
}
cout<<fixed;
cout<<setprecision(12);
cout<<mi<<' '<<ma;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
143 ms |
35252 KB |
Output is correct |
2 |
Correct |
207 ms |
27068 KB |
Output is correct |
3 |
Correct |
239 ms |
30460 KB |
Output is correct |
4 |
Correct |
198 ms |
32580 KB |
Output is correct |
5 |
Correct |
157 ms |
19964 KB |
Output is correct |
6 |
Correct |
183 ms |
45248 KB |
Output is correct |
7 |
Correct |
204 ms |
32304 KB |
Output is correct |
8 |
Correct |
232 ms |
60140 KB |
Output is correct |
9 |
Runtime error |
21 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |