# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1009082 | bornag | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 1018 ms | 428 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>
using namespace std;
#define ll long long
#define ld long double
ll lx, ly, gx, gy;
string cmd, s;
ll k;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cout << fixed << setprecision(12);
cin >> k >> s;
cin >> lx >> ly >> gx >> gy;
ld mxi = -1;
ld mni = LLONG_MAX;
ld di = sqrt(abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly));
mxi = max(mxi, di);
mni = min(mni, di);
for(int i = 0; i < k; i++){
for(auto c : s){
if(c == 'L') gx--;
else if(c == 'R') gx++;
else if(c == 'F') gy++;
else if(c == 'B') gy--;
di = sqrt(abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly));
mxi = max(mxi, di);
mni = min(mni, di);
}
}
cout << mni << ' ' << mxi << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |