結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2020-06-05 22:29:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 3,955 ms |
| コンパイル使用メモリ | 258,800 KB |
| 最終ジャッジ日時 | 2025-01-10 22:43:46 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 5 WA * 15 |
ソースコード
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k,x,y;
cin>>n>>k>>x>>y;
int a;
vector<int> A(n);
int sum=0;
rep(i,n){
cin>>a;
A[i]=(a-1+k-1)/k;
sum+=(a-1+k-1)/k;
}
sort(ALL(A));
int m;
m=(y+x-1)/x;
int sum1=0;
if(n<m) cout<<sum<<endl;
else{
rep(i,n){
if(A[i]>A[n-m]) sum1+=A[i]-A[n-m];
}
cout<<A[n-m]*y+sum1*x<<endl;
}
return 0;
}
umezo