結果

問題 No.1071 ベホマラー
ユーザー FuyuruFuyuru
提出日時 2020-06-15 17:44:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 726 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 109,856 KB
最終ジャッジ日時 2023-09-16 10:29:25
合計ジャッジ時間 9,661 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
90,720 KB
testcase_01 AC 221 ms
90,600 KB
testcase_02 AC 220 ms
90,592 KB
testcase_03 AC 221 ms
90,664 KB
testcase_04 WA -
testcase_05 AC 219 ms
90,812 KB
testcase_06 WA -
testcase_07 AC 221 ms
90,676 KB
testcase_08 AC 220 ms
90,776 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 256 ms
105,580 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 247 ms
108,812 KB
testcase_21 AC 247 ms
109,212 KB
testcase_22 AC 243 ms
108,948 KB
testcase_23 AC 244 ms
109,292 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N,K,X,Y = I()
A = l()
A.sort(reverse=True)
A = [math.ceil((A[i]-1)/K) for i in range(N)]
B = math.ceil(X/Y)
if X > Y:
    print(max(A))
    exit()
if X*N < Y:
    B = N+1
C = A[0:B]
if A[B:]:
    D = max(A[B:])
else:
    D = 0
ans = 0
for c in C:
    ans += X*(c-D)
ans += D*Y
print(ans)
0