結果
| 問題 |
No.1736 Princess vs. Dragoness
|
| コンテスト | |
| ユーザー |
Fullmoon85072
|
| 提出日時 | 2021-11-14 10:56:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 1,404 bytes |
| コンパイル時間 | 549 ms |
| コンパイル使用メモリ | 82,504 KB |
| 実行使用メモリ | 68,076 KB |
| 最終ジャッジ日時 | 2025-07-04 14:05:43 |
| 合計ジャッジ時間 | 3,073 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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")
Fullmoon85072