結果

問題 No.1071 ベホマラー
ユーザー kbyskbys
提出日時 2020-06-23 04:06:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 661 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 78,256 KB
最終ジャッジ日時 2023-09-16 19:42:20
合計ジャッジ時間 5,266 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
78,256 KB
testcase_01 AC 75 ms
71,244 KB
testcase_02 AC 74 ms
71,224 KB
testcase_03 AC 75 ms
71,244 KB
testcase_04 AC 78 ms
75,656 KB
testcase_05 AC 76 ms
71,336 KB
testcase_06 AC 75 ms
70,992 KB
testcase_07 AC 74 ms
71,312 KB
testcase_08 AC 72 ms
70,996 KB
testcase_09 AC 75 ms
71,448 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import sys
input=sys.stdin.readline

def main(args):
    N, K, X, Y = map(int,input().split())
    A = list(map(lambda x:-(-(int(x)-1)//K), input().split()))
    
    A.sort()
    
    ans = float('inf')
    l = 0
    behomara = 0
    while True:
        if behomara >= A[l]:
            l = bisect.bisect_right(A,behomara)
        #回復したい人数
        res = N - l
        if Y < res*X:
            behomara += 1
        else:
            behoimi = sum(map(lambda x:x-behomara,A[l:]))
            break
        if res == 0:
            break
            
    print(X*behoimi+Y*behomara)

if __name__ == '__main__':
    main(sys.argv[1:])
0