Submission #169565

# Submission time Handle Problem Language Result Execution time Memory
169565 2019-12-21T05:40:53 Z davitmarg Experiments with Gorlum (IZhO13_expgorl) C++17
0 / 100
272 ms 380 KB
/*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;

LL k, n, sx, sy, lx, ly, x[N], y[N];
string s;
LD mn = -1, 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;
    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 < k; i++)
        for (int j = 0; j <= n; j++)
        {
            LL Y = (y[n] * i + y[j] - ly), X = (x[n] * i + x[j] - lx);
            LD d = sqrtl(Y * Y + X * X);
            if (mn == -1)
                mn = d;
            mn = min(mn, d);
            mx = max(mx, d);
        }
    printf("%.9f %.9f\n", (double)mn, (double)mx);
    return 0;
}

/*


10
LRFBI
100000 100000
0 0


*/
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -