結果

問題 No.9 モンスターのレベル上げ
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-01-15 12:39:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,090 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 8,912 KB
最終ジャッジ日時 2023-09-06 05:09:23
合計ジャッジ時間 36,025 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,500 KB
testcase_01 AC 19 ms
8,424 KB
testcase_02 AC 3,588 ms
8,796 KB
testcase_03 AC 2,804 ms
8,812 KB
testcase_04 AC 1,509 ms
8,660 KB
testcase_05 AC 996 ms
8,624 KB
testcase_06 AC 367 ms
8,680 KB
testcase_07 AC 26 ms
8,452 KB
testcase_08 AC 474 ms
8,580 KB
testcase_09 AC 3,472 ms
8,772 KB
testcase_10 AC 19 ms
8,412 KB
testcase_11 AC 3,371 ms
8,876 KB
testcase_12 AC 4,090 ms
8,728 KB
testcase_13 AC 3,205 ms
8,788 KB
testcase_14 AC 3,464 ms
8,912 KB
testcase_15 AC 3,137 ms
8,856 KB
testcase_16 AC 74 ms
8,452 KB
testcase_17 AC 2,052 ms
8,800 KB
testcase_18 AC 1,726 ms
8,676 KB
testcase_19 AC 51 ms
8,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy, heapq

if __name__ == '__main__':
    n = int(input())
    abstract_ally = [(int(a), 0) for a in input().split()]
    enemy = [int(b) for b in input().split()]

    heapq.heapify(abstract_ally)

    answer = float('inf')
    for start in range(n):
        ally = copy.copy(abstract_ally)

        max_cnt = 0
        for diff in range(n):
            level, cnt = heapq.heappop(ally)
            i = (start + diff) % n

            heapq.heappush(ally, (level + enemy[i] // 2, cnt + 1))
            max_cnt = max(max_cnt, cnt + 1)

        answer = min(answer, max_cnt)
    
    print(answer)
0