#include <bits/stdc++.h>
#define f0(i, n) for(int i(0); i<(n); i++)
#define f1(i, n) for(int i(1); i<=(n); i++)
#define mu2(x) ((x)*(x))
using namespace std;
typedef long long ll;
const int N = 1e4 + 4;
int n, k;
long double toado1, toado2, g1, g2;
string s;
long double dist(long double x2, long double y2, long double x3, long double y3){
long double g = sqrt(mu2(x3 - x2) + mu2(y3 - y2));
return sqrt(g);
}
int main(){
ios_base::sync_with_stdio(0);
cin >> k; cin >> s;
n = s.length();
cin >> toado1 >> toado2 >> g1 >> g2;
long double mi = 2e9, ma = 0;
ma = max(ma, dist(toado1, toado2, g1, g2));
mi = min(mi, dist(toado1, toado1, g1, g2));
for(int i = 0; i < n*k; i++){
int u = i%n;
if(s[u]=='L') --g1;
if(s[u]=='R') ++g1;
if(s[u]=='F') ++g2;
if(s[u]=='B') --g2;
ma = max(ma, dist(toado1, toado2, g1, g2));
mi = min(mi, dist(toado1, toado1, g1, g2));
}
cout << fixed << setprecision(12);
cout << mi << " " << ma;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |