結果

問題 No.1736 Princess vs. Dragoness
ユーザー Fullmoon85072Fullmoon85072
提出日時 2021-11-14 10:56:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 1,404 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,680 KB
実行使用メモリ 76,472 KB
最終ジャッジ日時 2023-08-19 16:18:19
合計ジャッジ時間 5,804 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,296 KB
testcase_01 AC 70 ms
71,008 KB
testcase_02 AC 70 ms
71,320 KB
testcase_03 AC 106 ms
74,920 KB
testcase_04 AC 98 ms
76,168 KB
testcase_05 AC 73 ms
75,020 KB
testcase_06 AC 90 ms
76,372 KB
testcase_07 AC 101 ms
76,128 KB
testcase_08 AC 87 ms
76,128 KB
testcase_09 AC 95 ms
76,192 KB
testcase_10 AC 73 ms
75,012 KB
testcase_11 AC 111 ms
76,200 KB
testcase_12 AC 83 ms
76,200 KB
testcase_13 AC 89 ms
76,472 KB
testcase_14 AC 85 ms
76,444 KB
testcase_15 AC 79 ms
76,444 KB
testcase_16 AC 83 ms
76,148 KB
testcase_17 AC 87 ms
76,276 KB
testcase_18 AC 82 ms
76,052 KB
testcase_19 AC 81 ms
76,324 KB
testcase_20 AC 76 ms
75,740 KB
testcase_21 AC 87 ms
76,244 KB
testcase_22 AC 94 ms
76,268 KB
testcase_23 AC 77 ms
75,840 KB
testcase_24 AC 73 ms
75,728 KB
testcase_25 AC 81 ms
76,180 KB
testcase_26 AC 85 ms
76,244 KB
testcase_27 AC 85 ms
76,452 KB
testcase_28 AC 83 ms
76,128 KB
testcase_29 AC 77 ms
76,232 KB
testcase_30 AC 82 ms
76,160 KB
testcase_31 AC 88 ms
76,152 KB
testcase_32 AC 92 ms
76,308 KB
testcase_33 AC 69 ms
71,448 KB
testcase_34 AC 68 ms
71,428 KB
testcase_35 AC 70 ms
71,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

line = input().split(" ")
monster_num = int(line[0])
a_magic_num = int(line[1])
b_magic_num = int(line[2])
a_magic_damage = int(line[3])
b_magic_damage = int(line[4])

line = input().split(" ")
monster_hp_list = list()
for monster_hp in line:
    if not monster_hp == "":
        monster_hp_list.append(int(monster_hp))

# A Magic
for i in range(a_magic_num):
    max_value = max(monster_hp_list)
    max_index = monster_hp_list.index(max_value)

    monster_hp_list[max_index] = \
        max(0, monster_hp_list[max_index] - a_magic_damage)

    if max(monster_hp_list) == 0:
        print("Yes")
        sys.exit()

# B Magic
monster_counter = 0

for i in range(b_magic_num):
    b_magic_remaining = b_magic_damage

    while b_magic_remaining > 0:

        if b_magic_remaining < monster_hp_list[monster_counter]:
            monster_hp_list[monster_counter] -= b_magic_remaining
            b_magic_remaining = 0

        elif b_magic_remaining == monster_hp_list[monster_counter]:
            monster_hp_list[monster_counter] = 0
            b_magic_remaining = 0
            monster_counter += 1

        else:
            buf = monster_hp_list[monster_counter]

            monster_hp_list[monster_counter] = 0
            b_magic_remaining -= buf
            monster_counter += 1

        if monster_counter == monster_num:
            print("Yes")
            sys.exit()

print("No")
0