結果

問題 No.1736 Princess vs. Dragoness
ユーザー Shirapon_pon
提出日時 2021-11-15 11:27:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 70,608 KB
最終ジャッジ日時 2024-12-14 09:47:14
合計ジャッジ時間 4,064 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n, a, b, x, y = map(int, input().split())
h = [int(i) for i in input().split()]
h.sort()

def magicA():
    for i in range(n):
        if h[n-i-1] > 0:
            h[n-i-1] -= x
            break
    h.sort()

def magicB():
    p = y
    i = 0
    while p > 0 and i < n:
        if h[i] > 0:
            d = min(p,h[i])
            h[i] -= d
            p -= d
        i += 1

def check():
    if max(h) <= 0:
        return True
    return False

def is_clear():
    if check() and a == 0 and b == 0:
        print("Yes")
    else:
        print("No")

while not(check()) and a > 0:
    magicA()
    a -= 1
while not(check()) and b > 0:
    magicB()
    b -= 1
is_clear()
0