結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー neko_the_shadow
提出日時 2017-01-15 12:42:02
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,060 ms / 5,000 ms
コード長 606 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 163 ms
コンパイル使用メモリ 85,368 KB
実行使用メモリ 87,792 KB
最終ジャッジ日時 2026-03-09 06:56:12
合計ジャッジ時間 9,802 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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