#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
252 KB |
Output is correct |
2 |
Correct |
4 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
400 KB |
Output is correct |
4 |
Correct |
4 ms |
400 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
584 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
252 KB |
Output is correct |
2 |
Correct |
4 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
400 KB |
Output is correct |
4 |
Correct |
4 ms |
400 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
6 |
Incorrect |
4 ms |
584 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |