結果

問題 No.1736 Princess vs. Dragoness
ユーザー Shirapon_ponShirapon_pon
提出日時 2021-11-15 11:40:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 76,792 KB
最終ジャッジ日時 2023-08-21 02:26:09
合計ジャッジ時間 5,411 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,312 KB
testcase_01 AC 72 ms
71,432 KB
testcase_02 AC 72 ms
71,160 KB
testcase_03 AC 99 ms
75,904 KB
testcase_04 AC 88 ms
75,996 KB
testcase_05 AC 77 ms
75,312 KB
testcase_06 AC 109 ms
76,536 KB
testcase_07 AC 107 ms
76,780 KB
testcase_08 AC 91 ms
76,492 KB
testcase_09 AC 101 ms
76,792 KB
testcase_10 AC 75 ms
74,964 KB
testcase_11 AC 135 ms
76,516 KB
testcase_12 AC 98 ms
76,496 KB
testcase_13 AC 116 ms
76,568 KB
testcase_14 AC 114 ms
76,484 KB
testcase_15 AC 88 ms
75,896 KB
testcase_16 AC 98 ms
76,640 KB
testcase_17 AC 111 ms
76,404 KB
testcase_18 AC 114 ms
76,388 KB
testcase_19 AC 115 ms
76,484 KB
testcase_20 AC 88 ms
76,112 KB
testcase_21 AC 94 ms
76,488 KB
testcase_22 AC 99 ms
76,488 KB
testcase_23 AC 94 ms
75,936 KB
testcase_24 AC 84 ms
76,144 KB
testcase_25 AC 84 ms
76,664 KB
testcase_26 AC 105 ms
76,320 KB
testcase_27 AC 94 ms
76,460 KB
testcase_28 AC 87 ms
76,172 KB
testcase_29 AC 87 ms
76,088 KB
testcase_30 AC 109 ms
76,324 KB
testcase_31 AC 92 ms
76,572 KB
testcase_32 AC 102 ms
76,476 KB
testcase_33 AC 73 ms
71,312 KB
testcase_34 AC 72 ms
71,484 KB
testcase_35 AC 71 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

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():
        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