# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89112 | tarash117 | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 539 ms | 66560 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;
map<int,int>d;
int main(){
ios_base::sync_with_stdio(time);
cin.tie(0);
int k;cin>>k;
string s;
cin>>s;
int x1,x2,y1,y2;
cin>>x1>>y1>>x2>>y2;
d[0]=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
int n=s.size();
for(int i=1;i<=k;i++){
for(int j=1;j<=n;j++){
if(s[j]=='L')
x1-=1;
if(s[j]=='R')
x1+=1;
if(s[j]=='F')
y1+=1;
if(s[j]=='B')
y1-=1;
d[(i-1)*n+j]==sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
}
int mn=INT_MAX,mx=-1;
for(int i=0;i<=n*k;i++){
if(d[i]<mn)
mn=d[i];
if(d[i]>mx)
mx=d[i];
}
cout<<fixed<<setprecision(9)<<mn<<' ';
cout<<fixed<<setprecision(9)<<mx<<' ';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |