結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-07 09:40:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 771 ms |
| コンパイル使用メモリ | 78,656 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 16:18:38 |
| 合計ジャッジ時間 | 2,526 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
int main(){
unsigned N,K,X,Y;
std::cin>>N>>K>>X>>Y;
std::vector<unsigned> A(N);
int hp;
for (unsigned i=0;i<N;i++){
std::cin>>hp;
A[i]=(hp-1)/K;
if((hp-1)%K!=0){
A[i]++;
}
}
unsigned long long UsedMp=0;
std::sort(A.begin(),A.end(),std::greater<unsigned>());
if(Y/X<N){
hp=A[Y/X];
UsedMp+=((unsigned long long)A[Y/X])*Y;
}else{
hp=0;
}
for(unsigned i=0;i<N;i++){
if(A[i]<=(unsigned)hp)break;
UsedMp+=(unsigned long long)(A[i]-hp)*X;
}
std::cout<<UsedMp;
return 0;
}