#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;
int sx = gx;
int sy = gy;
double distmn = hypot((gy - ly), (gx - lx));
double distmx = hypot((gy - ly), (gx - lx));
double distmn1 = hypot((gy - ly), (gx - lx));
double distmx1 = hypot((gy - ly), (gx - lx));
for(int j = 0; j < k; j++)
{
for(int i = 0; i < s.size(); i++)
{
gx -= (s[i] == 'L');
gx += (s[i] == 'R');
gy += (s[i] == 'F');
gy -= (s[i] == 'B');
distmx1 = max(distmx1, hypot((gy - ly), (gx - lx)));
distmn1 = min(distmn1, hypot((gy - ly), (gx - lx)));
}
}
cout << distmn1 << " " << distmx1 << 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:41:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < s.size(); i++)
~~^~~~~~~~~~
expgorl.cpp:32:6: warning: unused variable 'sx' [-Wunused-variable]
int sx = gx;
^~
expgorl.cpp:33:6: warning: unused variable 'sy' [-Wunused-variable]
int sy = gy;
^~
expgorl.cpp:35:9: warning: unused variable 'distmn' [-Wunused-variable]
double distmn = hypot((gy - ly), (gx - lx));
^~~~~~
expgorl.cpp:36:9: warning: unused variable 'distmx' [-Wunused-variable]
double distmx = hypot((gy - ly), (gx - lx));
^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
481 ms |
504 KB |
Output is correct |
2 |
Correct |
618 ms |
504 KB |
Output is correct |
3 |
Correct |
645 ms |
548 KB |
Output is correct |
4 |
Correct |
720 ms |
548 KB |
Output is correct |
5 |
Correct |
375 ms |
548 KB |
Output is correct |
6 |
Correct |
576 ms |
548 KB |
Output is correct |
7 |
Correct |
598 ms |
548 KB |
Output is correct |
8 |
Correct |
825 ms |
548 KB |
Output is correct |
9 |
Execution timed out |
1081 ms |
548 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |