Submission #532858

#TimeUsernameProblemLanguageResultExecution timeMemory
532858rk42745417Soccer (JOI17_soccer)C++17
5 / 100
1 ms332 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...