結果

問題 No.1071 ベホマラー
ユーザー kbyskbys
提出日時 2020-06-23 06:03:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 19,220 KB
最終ジャッジ日時 2023-09-16 19:43:18
合計ジャッジ時間 2,777 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,996 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
8,020 KB
testcase_04 WA -
testcase_05 AC 16 ms
8,000 KB
testcase_06 WA -
testcase_07 AC 16 ms
8,016 KB
testcase_08 AC 16 ms
8,064 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 95 ms
16,976 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 WA -
testcase_21 AC 71 ms
19,136 KB
testcase_22 WA -
testcase_23 AC 72 ms
18,968 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import sys
input=sys.stdin.readline

def main(args):
    N, K, bhim, bhmr = map(int,input().split())
    A = list(map(lambda x:-(-(int(x)-1)//K), input().split()))
    A.sort()
    
    prev = 0
    ans = 0
    #print("A :",A)
    for i in range(N):
        #print('##############')
        if A[i] != prev:
            if bhim < bhim*(N-i):
                ans += bhmr*(A[i]-prev)
            else:
                #残りはベホイミしたほうがいい
                break
            prev = A[i]
            #print(ans)
        A[i] = 0
    
    if sum(A) > 0:
        ans += (sum(A) - (N-i)*prev)*bhim
        
    print(ans)

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