# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89037 | temoyanteladze | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 2 ms | 376 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 ll long long
#define x first
#define y second
using namespace std;
double func(ll x1,ll y1,ll x2,ll y2){
double db=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
return db;
};
int main() {
ll n;
string v;
cin>>n>>v;
ll x1,y1,x2,y2;
cin>>x1>>y1;
cin>>x2>>y2;
double mn=10e7,mx=0;
for (ll i=0;i<v.size();i++)
{
if(v[i]=='L')
x2--;
if (v[i]=='R')
x2++;
if (v[i]=='F')
y2++;
if (v[i]=='B')
y2--;
ll t=func(x1,x2,y1,y2);
mn=min(mn,double(t));
mx=max(mx,double(t));
}
cout<<setprecision(9)<<mn<<' ';
cout<<setprecision(9)<<mx<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |