結果

問題 No.1736 Princess vs. Dragoness
コンテスト
ユーザー flippergo
提出日時 2024-12-29 11:10:50
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 111 ms / 2,000 ms
+ 413µs
コード長 555 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 253 ms
コンパイル使用メモリ 95,848 KB
実行使用メモリ 85,184 KB
最終ジャッジ日時 2026-07-13 00:59:31
合計ジャッジ時間 5,297 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import heapq
N,A,B,X,Y = map(int,input().split())
H = list(map(int,input().split()))
heap = []
for i in range(N):
    heapq.heappush(heap,-H[i])
cnt = 0
while heap and cnt<A:
    h = -heapq.heappop(heap)
    h -= X
    cnt += 1
    if h>0:
        heapq.heappush(heap,-h)
for _ in range(B):
    p = Y
    A = []
    while p>0 and heap:
        h = -heapq.heappop(heap)
        d = min(h,p)
        h -= d
        p -= d
        if h>0:
            A.append(h)
    for a in A:
        heapq.heappush(heap,-a)
if heap:
    print("No")
else:
    print("Yes")
0