結果

問題 No.1071 ベホマラー
ユーザー seratnaseratna
提出日時 2020-06-19 02:00:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 106,364 KB
実行使用メモリ 4,840 KB
最終ジャッジ日時 2023-09-16 12:33:52
合計ジャッジ時間 18,297 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1,355 ms
4,380 KB
testcase_11 AC 369 ms
4,380 KB
testcase_12 AC 1,342 ms
4,376 KB
testcase_13 AC 254 ms
4,376 KB
testcase_14 AC 1,359 ms
4,380 KB
testcase_15 AC 312 ms
4,480 KB
testcase_16 AC 1,366 ms
4,576 KB
testcase_17 AC 237 ms
4,620 KB
testcase_18 AC 1,365 ms
4,668 KB
testcase_19 AC 1,363 ms
4,488 KB
testcase_20 AC 1,360 ms
4,612 KB
testcase_21 AC 1,359 ms
4,480 KB
testcase_22 AC 1,359 ms
4,564 KB
testcase_23 AC 1,362 ms
4,840 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    vector<pair<ll,ll>> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i].first;
        a[i].second = (a[i].first - 1 + k-1) / k;
    }
    sort(a.begin(),a.end());

    if(a[n-1].first == 1){
        cout<<0<<endl;
        return 0;
    }

    ll ans = 0;
    ll rem = n;
    ll tmp = 0;
    for(ll i=1;i <= a[n-1].second; i++){
        ans += min( rem * x, y );
        while(i == a[tmp].second){
            rem--;
            tmp++;
        }
    }

    cout<<ans<<endl;
}
0