Submission #1290489

#TimeUsernameProblemLanguageResultExecution timeMemory
1290489muhammadali_2009Soccer (JOI17_soccer)C++20
0 / 100
1 ms568 KiB
// +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+ // 
#include <bits/stdc++.h> 
//#include<ext/pb_ds/assoc_container.hpp> 
//#include<ext/pb_ds/tree_policy.hpp> 
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) 
#define endl '\n' 
#define ll long long 
#define int long long 
#define all(x) x.begin(), x.end() 
#define all1(x) x.rbegin(), x.rend() 
#define seea(x) for(int i = 0; i < x; i++) 
#define pb push_back 
#define ff first 
#define vc vector 
#define ss second 
#define ld long double 

using namespace std; 
//using namespace __gnu_pbds; 
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
const int mod = 1e9 + 7; 

void solve(){
    int n, m; cin >> n >> m;
    int aa, b, c; cin >> aa >> b >> c;
    int q; cin >> q;
    vc<pair<int, int>>a(q);
    seea(q)cin >> a[i].ff >> a[i].ss;
    int ans = 1e18;
    int p = c;
    swap(a[1], a[n - 1]);
    //c = 1; aa = 1; b = 0;
    ans = min(ans, c * abs(a[0].ff - a[1].ff) + c * abs(a[0].ss - a[1].ss));    
    ans = min(ans, c * abs(a[0].ff - a[1].ff) + aa * abs(a[0].ss - a[1].ss) + b);
    ans = min(ans, c * abs(a[0].ss - a[1].ss) + aa * abs(a[0].ff - a[1].ff) + b);
    cout << ans << endl;
}   

signed main(){ 
    fast; 
    int t = 1; 
    //cin >> t; 
    while (t --){ 
        solve(); 
    } 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...