Submission #1099282

#TimeUsernameProblemLanguageResultExecution timeMemory
1099282YFHHFYSoccer (JOI17_soccer)C++17
5 / 100
2 ms3164 KiB
#include<bits/stdc++.h> #define tizoboz ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long #define ld long double #define pb push_back // #define int long long #define itn int #define ss set <int> #define prq priority_queue <int> #define endl '\n' const ll MOD = 1e9 + 7; #define md(x) (((x%MOD)+MOD)%MOD) #define vi vector <int> #define vl vector<ll> #define str string #define mp make_pair #define mata int32_t #define sz size #define lc id *2 #define rc lc +1 #define SZ(x) (int)x.size() #define mid (l+r)/2 #define cn cin #define ct cout #define F first #define S second #define sep " " using namespace std; typedef pair <int , int> pii; const ll maxn = 2e6 + 5 ; const int Lg = 23; const ll inf = 1e18 ; ll h , w , A , B , C , n; vector <pii> vp(100010); ll dp[510][510]; ll dist(ll x , ll y , ll X , ll Y){ return abs (x-X) + abs(y-Y); } ll shoot (ll x , ll y , ll X , ll Y){ ll res1 = abs(x-X) *C; ll res2 = abs(y-Y)*C; res1 += A*dist(X,y,X,Y) + B; res2 += A*dist(x,Y,X,Y) + B; return min (res1 , res2); } void solve (){ cn >> h >> w >> A >> B >> C >> n; for (int i = 1 ; i <= n ; i++){ cn >> vp[i].first >> vp[i].second; } for (int i = 00 ; i <= 500 ; i ++){ for (int j = 0 ; j <= 500 ; j++){ dp[i][j] = dist(vp[1].first , vp[1].second , i , j) * C; } } ct << min ({dp[vp[2].first][vp[2].second] , shoot(vp[1].F, vp[1].S, vp[2].F, vp[2].S)}); } mata main(){ tizoboz; int tt = 1; // cn >> tt; while (tt--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...