結果

問題 No.1071 ベホマラー
ユーザー furafura
提出日時 2020-06-05 21:30:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 202,896 KB
実行使用メモリ 4,740 KB
最終ジャッジ日時 2023-08-22 14:21:47
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 17 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 24 ms
4,708 KB
testcase_18 AC 24 ms
4,636 KB
testcase_19 AC 24 ms
4,664 KB
testcase_20 AC 18 ms
4,572 KB
testcase_21 WA -
testcase_22 AC 18 ms
4,724 KB
testcase_23 AC 18 ms
4,740 KB
testcase_24 AC 23 ms
4,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n;
	lint k,x,y; scanf("%d%lld%lld%lld",&n,&k,&x,&y);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	rep(i,n) a[i]=(a[i]-1+k-1)/k;
	sort(a.begin(),a.end());

	vector<lint> cum(n+1);
	rep(i,n) cum[i+1]=cum[i]+a[i];

	lint ans=cum[n]*x;
	rep(i,n){
		ans=min(ans,a[i]*y+(cum[n]-cum[i+1]-(n-i-1)*a[i])*x);
	}
	printf("%lld\n",ans);

	return 0;
}
0