比赛 果蝇王邀请赛div2 评测结果 AAAAAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
题目名称 雪王与果蝇王游于濠梁之上 最终得分 5
用户昵称 zcx 运行时间 0.097 s
代码语言 C++ 内存使用 3.68 MiB
提交时间 2026-08-27 11:21:19
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int INF = 1e18;

int h,w;
int a,b,c,n;

int x[50],y[50];

signed main()
{
    freopen("play.in","r",stdin);
    freopen("play.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>h>>w;
    cin>>a>>b>>c;
    cin>>n;
    cin>>x[1]>>y[1]>>x[2]>>y[2];
    int ans = INF;
    
    if(x[1] == x[2]) ans = min(abs(y[1] - y[2]) * c,abs(y[1] - y[2]) * a + b);
    else if(y[1] == y[2]) ans = min(abs(x[1] - x[2]) * c,abs(x[1] - x[2]) * a + b);
    else ans = min({
        abs(x[1] - x[2]) * c + abs(y[1] - y[2]) * a + b,
        abs(y[1] - y[2]) * c + abs(x[1] - x[2]) * a + b,
        abs(x[1] - x[2]) * c + abs(y[1] - y[2]) * c
    });
    
    cout<<ans<<'\n';
    
    return 0;
}