結果

問題 No.1736 Princess vs. Dragoness
ユーザー Shirotsume
提出日時 2021-10-28 22:54:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,672 KB
実行使用メモリ 66,416 KB
最終ジャッジ日時 2025-07-04 14:01:46
合計ジャッジ時間 2,669 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n, a, b, x, y = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
q1 = deque(h)
q2 = deque()

for i in range(a):
    now = 0
    if not q1:
        now = q2.pop()
    elif not q2:
        now = q1.pop()
    
    elif q1[-1] > q2[-1]:
        now = q1.pop()
    else:
        now = q2.pop()
    now = max(now - x, 0)
    q2.appendleft(now)
if sum(q1) + sum(q2) <= b * y:
    print('Yes')
else:
    print('No')



0