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 int long long
using namespace std;
signed main(){
	int H, W, A, B, C, N;
	cin >> H>> W>> A>> B>> C>> N;
	vector<int> px(N), py(N);
	for(int i = 0; i < N; i ++){
		cin >> px[i] >> py[i];
	}
	if(N == 2){
		int dx = labs(px[0]-px[1]), dy = labs(py[0]-py[1]);
		int a = (dx + dy) * C;
		int b = min({dx * A + B + dy * C, dy * A + B + dx * C, a});
		cout << b << 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... |