結果

問題 No.1736 Princess vs. Dragoness
ユーザー H20
提出日時 2021-11-12 21:44:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,120 KB
実行使用メモリ 76,800 KB
最終ジャッジ日時 2024-11-25 17:46:25
合計ジャッジ時間 3,740 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N,A,B,X,Y = map(int, input().split())
H = list(map(int, input().split()))
HQ = []
for i in range(N):
    heapq.heappush(HQ,(-H[i],i))
for _ in range(A):
    hi,i = heapq.heappop(HQ)
    H[i]-=X
    heapq.heappush(HQ,(-H[i],i))

for i in range(B):
    y = Y
    j = 0
    while y>0 and j<N:
        d = min(y,H[j])
        if d>0:
            H[j]-=d
            y-=d
        j+=1
if max(H)<=0:
    print('Yes')
else:
    print('No')
0