結果

問題 No.9 モンスターのレベル上げ
ユーザー DialBirdDialBird
提出日時 2019-07-25 16:12:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,339 ms / 5,000 ms
コード長 614 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 8,672 KB
最終ジャッジ日時 2023-09-15 00:00:02
合計ジャッジ時間 19,293 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,020 KB
testcase_01 AC 16 ms
8,148 KB
testcase_02 AC 1,885 ms
8,628 KB
testcase_03 AC 1,461 ms
8,532 KB
testcase_04 AC 784 ms
8,464 KB
testcase_05 AC 531 ms
7,992 KB
testcase_06 AC 192 ms
8,480 KB
testcase_07 AC 20 ms
8,016 KB
testcase_08 AC 252 ms
8,452 KB
testcase_09 AC 1,823 ms
8,512 KB
testcase_10 AC 16 ms
8,016 KB
testcase_11 AC 1,620 ms
8,608 KB
testcase_12 AC 2,339 ms
8,612 KB
testcase_13 AC 1,557 ms
8,568 KB
testcase_14 AC 1,827 ms
8,672 KB
testcase_15 AC 1,667 ms
8,564 KB
testcase_16 AC 45 ms
8,000 KB
testcase_17 AC 1,066 ms
8,424 KB
testcase_18 AC 899 ms
8,584 KB
testcase_19 AC 33 ms
7,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heapreplace

def main():
    """ main """
    N = int(input())
    FRIENDS = list(map(lambda x: (int(x), 0), input().split()))
    ENEMIES = list(map(lambda x: int(x)//2, input().split()))

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

    print(max_value)

main()
0