#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
void FS() {
cout << fixed << setprecision(48);
}
main()
{
FS();
int k, lx, ly, gx, gy;
string s;
cin >> k >> s;
cin >> lx >> ly;
cin >> gx >> gy;
string ss = "";
for(int i = 0; i < k; i++)
ss += s;
s = ss;
double distmn = hypot((gy - ly), (gx - lx));
double distmx = hypot((gy - ly), (gx - lx));
for(int i = 0; i < s.size(); i++)
{
gx -= (s[i] == 'L');
gx += (s[i] == 'R');
gy += (s[i] == 'F');
gy -= (s[i] == 'B');
distmx = max(distmx, hypot((gy - ly), (gx - lx)));
distmn = min(distmn, hypot((gy - ly), (gx - lx)));
}
cout << distmn << " " << distmx << endl;
}
/*
100000
LRFBI
10000 10000
10000 10000
*/
Compilation message
expgorl.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
expgorl.cpp: In function 'int main()':
expgorl.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < s.size(); i++)
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
535 ms |
40448 KB |
Output is correct |
2 |
Correct |
687 ms |
51496 KB |
Output is correct |
3 |
Correct |
717 ms |
57316 KB |
Output is correct |
4 |
Correct |
811 ms |
60288 KB |
Output is correct |
5 |
Correct |
414 ms |
60288 KB |
Output is correct |
6 |
Correct |
641 ms |
60288 KB |
Output is correct |
7 |
Correct |
661 ms |
60288 KB |
Output is correct |
8 |
Runtime error |
118 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |