結果

問題 No.9 モンスターのレベル上げ
ユーザー DialBirdDialBird
提出日時 2019-07-25 15:59:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 648 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,668 KB
最終ジャッジ日時 2023-09-14 23:59:04
合計ジャッジ時間 17,986 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
8,084 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 497 ms
7,988 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 16 ms
8,004 KB
testcase_11 AC 1,561 ms
8,444 KB
testcase_12 WA -
testcase_13 AC 1,495 ms
8,636 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 32 ms
8,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappush, heapreplace

def main():
    """ main """
    N = int(input())
    FRIENDS = list(map(int, input().split()))
    ENEMIES = list(map(int, input().split()))

    friends_origin = [(i, 0) for i in FRIENDS]
    max_value = float('inf')
    # # 的の順番ごとに一つ一つ確認していく
    for n in range(N):
        friends = friends_origin[:]
        enemies = ENEMIES[n:] + ENEMIES[:n]
        for enemy in enemies:
            lv, cnt = friends[0]
            heapreplace(friends, (lv+enemy//2, cnt+1))
        max_value = min(max_value, max(cnt for lv, cnt in friends))

    print(max_value)

main()
0