結果

問題 No.1071 ベホマラー
ユーザー mkawa2mkawa2
提出日時 2021-05-28 14:47:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 946 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 20,192 KB
最終ジャッジ日時 2024-04-24 19:00:25
合計ジャッジ時間 3,670 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,624 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 32 ms
10,624 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 31 ms
10,624 KB
testcase_09 AC 32 ms
10,624 KB
testcase_10 AC 144 ms
18,472 KB
testcase_11 AC 137 ms
18,228 KB
testcase_12 AC 98 ms
15,828 KB
testcase_13 AC 119 ms
17,468 KB
testcase_14 AC 146 ms
18,976 KB
testcase_15 AC 165 ms
20,064 KB
testcase_16 AC 168 ms
20,184 KB
testcase_17 AC 160 ms
20,192 KB
testcase_18 AC 155 ms
20,188 KB
testcase_19 AC 163 ms
20,184 KB
testcase_20 AC 132 ms
20,192 KB
testcase_21 AC 131 ms
20,184 KB
testcase_22 AC 132 ms
20,184 KB
testcase_23 AC 123 ms
20,184 KB
testcase_24 AC 148 ms
20,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

n, k, x, y = LI()
aa = LI()
aa.sort()
aa = [(a+k-2)//k for a in aa]

ans=0
b=0
for i,a in enumerate(aa):
    if (n-i)*x>y:
        ans+=(a-b)*y
        b=a
    else:
        ans+=(a-b)*x

print(ans)
0