#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
double func(double x1,double y1,double x2,double y2){
double db=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
return sqrt(db);
};
int main() {
ll n;
string v;
cin>>n>>v;
double x1,y1,x2,y2;
cin>>x1>>y1;
cin>>x2>>y2;
double mn=10e7,mx=0;
mx=func(x1,y1,x2,y2);
mn=mx;
for (ll i=0;i<n;i++)
for (ll i=0;i<v.size();i++)
{
if(v[i]=='L')
x2--;
if (v[i]=='R')
x2++;
if (v[i]=='F')
y2++;
if (v[i]=='B')
y2--;
double t=func(x1,y1,x2,y2);
mn=min(mn,t);
mx=max(mx,t);
}
cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;
return 0;
}
Compilation message
expgorl.cpp: In function 'int main()':
expgorl.cpp:21:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (ll i=0;i<v.size();i++)
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
87 ms |
376 KB |
Output is correct |
2 |
Correct |
114 ms |
508 KB |
Output is correct |
3 |
Correct |
126 ms |
576 KB |
Output is correct |
4 |
Correct |
144 ms |
576 KB |
Output is correct |
5 |
Correct |
71 ms |
576 KB |
Output is correct |
6 |
Correct |
103 ms |
576 KB |
Output is correct |
7 |
Correct |
111 ms |
652 KB |
Output is correct |
8 |
Correct |
158 ms |
652 KB |
Output is correct |
9 |
Execution timed out |
1076 ms |
652 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |