Submission #532858

# Submission time Handle Problem Language Result Execution time Memory
532858 2022-03-04T05:45:59 Z rk42745417 Soccer (JOI17_soccer) C++17
5 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(4e18) + ll(2e15);
const double EPS = 1e-9;
static int LamyIsCute = []() {
	EmiliaMyWife
	return 48763;
}();

signed main() {
	int h, w;
	cin >> h >> w;
	ll a, b, c;
	cin >> a >> b >> c;
	ll ans = LINF;
	int n;
	cin >> n;
	vector<pair<int, int>> arr(n);
	for(int i = 0; i < n; i++)
		cin >> arr[i].first >> arr[i].second;
	for(int i = 0; i <= h; i++) {
		for(int j = 0; j <= w; j++) {
			int x = abs(arr[0].first - i) + abs(arr[0].second - j);
			int y = abs(arr[1].first - i) + abs(arr[1].second - j);
			if(arr[1].first == i || arr[1].second == j)
				ans = min(ans, x * c + y * a + (!!y) * b);
		}
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -