# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38113 | Talant | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 549 ms | 2028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
const int inf = (int)1e9 + 7;
const int N = (int)1e6 + 7;
double dist (int x,int y,int l,int r) {
return sqrt((x - l) * (x - l) + (y - r) * (y - r));
}
int k;
string a;
int x,y,l,r;
double mn = inf,mx = 0;
main () {
cin >> k;
cin >> a;
cin >> x >> y;
cin >> l >> r;
for (int i = 1; i <= k; i ++) {
for (int j = 0; j < a.size(); j ++) {
if (a[j] == 'L')
l --;
if (a[j] == 'R')
l ++;
if (a[j] == 'F')
r ++;
if (a[j] == 'B')
r --;
mn = min(mn,dist(x,y,l,r));
mx = max(mx,dist(x,y,l,r));
}
}
cout << fixed << setprecision(12) << mn << " " << mx << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |