結果
問題 |
No.1071 ベホマラー
|
ユーザー |
![]() |
提出日時 | 2020-06-05 21:31:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 232 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,796 KB |
最終ジャッジ日時 | 2024-12-17 13:30:22 |
合計ジャッジ時間 | 3,851 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
import sys input = sys.stdin.readline N,K,X,Y=map(int,input().split()) A=list(map(int,input().split())) R=[(a-1+K-1)//K for a in A] import heapq heapq.heapify(R) ANS=0 common=0 #print(R) while R: #print(ANS,R) while R and R[0]<=common: heapq.heappop(R) if len(R)*X>Y: ANS+=(R[0]-common)*Y common+=R[0]-common else: for t in R: ANS+=max(0,t-common)*X break print(ANS)