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<iostream>
#include<stdio.h>
using namespace std;
typedef long long int lld;
lld absol(lld x){
if(x>0)return x;
return -x;
}
int main(){
int h,w;
cin>>h>>w;
lld a,b,c;
cin>>a>>b>>c;
int n;
cin>>n;
lld x1,y1;
lld x2,y2;
cin>>x1>>y1>>x2>>y2;
lld ans=absol(x1-x2)+absol(y1-y2);
ans*=c;
ans=min(ans,absol(x1-x2)*c+absol(y1-y2)*a+b);
ans=min(ans,absol(x1-x2)*a+b+absol(y1-y2)*c);
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |