Submission #38114

# Submission time Handle Problem Language Result Execution time Memory
38114 2018-01-01T07:57:46 Z Talant Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
543 ms 2028 KB
#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(10) << mn << " " << fixed << setprecision(12) << mx << endl;
}

Compilation message

expgorl.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
expgorl.cpp: In function 'int main()':
expgorl.cpp:33:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (int j = 0; j < a.size(); j ++) {
                                   ^
# Verdict Execution time Memory Grader output
1 Incorrect 543 ms 2028 KB Output isn't correct
2 Halted 0 ms 0 KB -