Submission #489131

#TimeUsernameProblemLanguageResultExecution timeMemory
489131cheissmartSoccer (JOI17_soccer)C++14
0 / 100
1 ms316 KiB
#include <bits/stdc++.h>
#define IO_OP ios::sync_with_stdio(0), cin.tie(0)
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emaplce_back
#define MP make_pair
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;
const ll oo = 1e18;

signed main()
{
	IO_OP;
	
	int h, w, a, b, c, n;
	cin >> h >> w >> a >> b >> c >> n;
	vi s(n), t(n);
	for(int i = 0; i < n; i++)
		cin >> s[i] >> t[i];
	ll ans = oo;
	ans = min(ans, 1LL * (abs(s[0] - s[1]) + abs(t[0] - t[1])) * c);
	ans = min(ans, 1LL * (abs(t[0] - t[1])) * a + b + abs(s[0] - s[1]) * c);
	ans = min(ans, 1LL * (abs(s[0] - s[1])) * a + b + abs(t[0] - t[1]) * c);
	
	cout << ans << '\n';
		
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...