結果

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

ソースコード

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