답안 #1099282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099282 2024-10-11T05:22:56 Z YFHHFY Soccer (JOI17_soccer) C++17
5 / 100
2 ms 3164 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3160 KB Output is correct
2 Correct 2 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 2 ms 3144 KB Output is correct
5 Correct 2 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3160 KB Output is correct
2 Correct 2 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 2 ms 3144 KB Output is correct
5 Correct 2 ms 3160 KB Output is correct
6 Incorrect 2 ms 3164 KB Output isn't correct
7 Halted 0 ms 0 KB -