結果

問題 No.9 モンスターのレベル上げ
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-01-15 12:35:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,428 ms / 5,000 ms
コード長 570 bytes
コンパイル時間 1,071 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 109,324 KB
最終ジャッジ日時 2023-09-06 05:07:25
合計ジャッジ時間 25,789 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,664 KB
testcase_01 AC 86 ms
71,996 KB
testcase_02 AC 2,428 ms
106,452 KB
testcase_03 AC 1,950 ms
99,036 KB
testcase_04 AC 1,174 ms
88,000 KB
testcase_05 AC 863 ms
84,316 KB
testcase_06 AC 477 ms
80,780 KB
testcase_07 AC 168 ms
79,000 KB
testcase_08 AC 525 ms
81,832 KB
testcase_09 AC 2,368 ms
106,076 KB
testcase_10 AC 86 ms
71,760 KB
testcase_11 AC 2,128 ms
106,748 KB
testcase_12 AC 2,029 ms
89,444 KB
testcase_13 AC 1,920 ms
109,324 KB
testcase_14 AC 2,251 ms
104,788 KB
testcase_15 AC 2,072 ms
102,584 KB
testcase_16 AC 225 ms
80,032 KB
testcase_17 AC 1,453 ms
93,188 KB
testcase_18 AC 1,231 ms
89,564 KB
testcase_19 AC 194 ms
79,120 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.deepcopy(abstract_ally)

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

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

        answer = min(answer, max(cnt for level, cnt in ally))
    
    print(answer)
0