#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Incorrect |
0 ms |
316 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Incorrect |
0 ms |
316 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |