# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
169590 | davitmarg | 생물 실험 (IZhO13_expgorl) | C++17 | 1068 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;
const int N = 10004;
LD dist(LL Y, LL X)
{
return sqrtl(Y * Y + X * X);
}
LL k, n, sx, sy, lx, ly, x[N], y[N];
string s;
LD mn, mx;
int main()
{
cin >> k;
cin >> s;
n = s.length();
s = "#" + s;
cin >> ly >> lx >> sy >> sx;
ly -= sy;
lx -= sx;
sy = 0;
sx = 0;
mn = mx = dist(ly, lx);
for (int i = 1; i <= n; i++)
{
x[i] = x[i - 1];
y[i] = y[i - 1];
if (s[i] == 'R')
x[i]++;
else if (s[i] == 'L')
x[i]--;
else if (s[i] == 'F')
y[i]++;
else if (s[i] == 'B')
y[i]--;
}
for (LL i = 0; i <= 1000000; i++)
for (int j = 1; j <= n; j++)
{
LL Y = (y[n] * i + y[j] - ly);
LL X = (x[n] * i + x[j] - lx);
LD d = dist(Y, X);
//cout << Y << " : " << X << endl;
mn = min(mn, d);
mx = max(mx, d);
}
printf("%.12f %.12f\n", (double)mn, (double)mx);
return 0;
}
/*
2
BB
1000 1003
1000 1000
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |