結果
問題 |
No.1071 ベホマラー
|
ユーザー |
![]() |
提出日時 | 2020-06-19 02:00:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 891 ms |
コンパイル使用メモリ | 103,240 KB |
最終ジャッジ日時 | 2025-01-11 05:19:14 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 19 WA * 1 |
ソースコード
#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; }