結果
問題 | No.1071 ベホマラー |
ユーザー |
|
提出日時 | 2020-06-06 00:04:35 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 2,148 ms |
コンパイル使用メモリ | 164,156 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 18:28:49 |
合計ジャッジ時間 | 3,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define Ll __int128#define ll unsigned long longint main(){ll n,k,x,y;cin>>n>>k>>x>>y;ll a[n];vector<ll> v;for(int i=0; i<n; i++){cin>>a[i];v.push_back((a[i]-1+k-1)/k);}sort(v.begin(),v.end());ll ans=0;ll now=0;for(int i=0; i<n; i++){ll u=v[i];ans+=min(y,(n-i)*x)*(u-now);now=u;}cout<<ans<<endl;}