Submission #432963

#TimeUsernameProblemLanguageResultExecution timeMemory
432963rqiSoccer (JOI17_soccer)C++14
5 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; #define mp make_pair #define f first #define s second int H, W; ll A, B, C; const int mx = 100005; int N; pi ST[mx]; ll KICK(pi a, pi b){ int xdist = abs(a.f-b.f); int ydist = abs(a.s-b.s); return min(C*(xdist+ydist), B+A*(max(xdist, ydist))+C*(min(xdist, ydist))); } int main(){ cin >> H >> W; cin >> A >> B >> C; cin >> N; for(int i = 1; i <= N; i++){ cin >> ST[i].f >> ST[i].s; } if(N == 2){ ll ans = KICK(ST[1], ST[2]); cout << ans << "\n"; exit(0); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...