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 va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll h, w, a, b, c, n;
pll arr[101010];
int main() {
cin >> h >> w >> a >> b >> c >> n;
for (int i=0; i<n; i++) {
cin >> arr[i].va >> arr[i].vb;
}
ll x = abs(arr[0].va-arr[1].va);
ll y = abs(arr[0].vb-arr[1].vb);
cout << min({c*(x+y), a*x+b+c*y, c*x+a*y+b});
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |