結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2020-06-07 01:01:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 1,030 bytes |
| コンパイル時間 | 1,209 ms |
| コンパイル使用メモリ | 97,428 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 14:33:04 |
| 合計ジャッジ時間 | 2,516 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 1071.cc: No.1071 ベホマラー - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 100000;
const long long LINF = 1LL << 62;
/* typedef */
typedef long long ll;
/* global variables */
int cs[MAX_N];
/* subroutines */
/* main */
int main() {
int n, k, x, y;
scanf("%d%d%d%d", &n, &k, &x, &y);
for (int i = 0; i < n; i++) {
int ai;
scanf("%d", &ai);
cs[i] = ((ai - 1) + (k - 1)) / k;
}
sort(cs, cs + n);
ll sum = 0;
for (int i = 0, pc = 0; i < n; i++) {
if (y < (ll)(n - i) * x)
sum += (ll)(cs[i] - pc) * y;
else
sum += (ll)(cs[i] - pc) * (n - i) * x;
pc = cs[i];
}
printf("%lld\n", sum);
return 0;
}
tnakao0123