This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#ifdef KEK
#define FILE_IN "input.txt"
#define FILE_OUT "output.txt"
#endif
#include <iostream>
#include <cstdlib>
#include <climits>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
void openFiles() {
#ifdef KEK
assert(freopen(FILE_IN, "r", stdin));
assert(freopen(FILE_OUT, "w", stdout));
#endif
}
struct Point {
int x, y;
};
int main() {
openFiles();
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int h, w;
cin >> h >> w;
ll A, B, C;
cin >> A >> B >> C;
int n;
cin >> n;
Point s, t;
cin >> s.x >> s.y;
cin >> t.x >> t.y;
ll ans = LLONG_MAX;
ans = min(ans, (abs(s.x - t.x) + abs(s.y - t.y)) * C);
ans = min(ans, abs(s.x - t.x) * C + abs(s.y - t.y) * A + B);
ans = min(ans, abs(s.y - t.y) * C + abs(s.x - t.x) * A + B);
cout << ans;
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... |