結果

問題 No.9 モンスターのレベル上げ
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-01-15 12:42:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,159 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 1,437 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 86,344 KB
最終ジャッジ日時 2023-09-06 05:08:26
合計ジャッジ時間 13,331 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,168 KB
testcase_01 AC 91 ms
71,536 KB
testcase_02 AC 1,156 ms
85,456 KB
testcase_03 AC 1,021 ms
84,584 KB
testcase_04 AC 619 ms
80,708 KB
testcase_05 AC 467 ms
79,712 KB
testcase_06 AC 293 ms
78,988 KB
testcase_07 AC 145 ms
78,352 KB
testcase_08 AC 312 ms
79,208 KB
testcase_09 AC 1,159 ms
86,344 KB
testcase_10 AC 91 ms
71,660 KB
testcase_11 AC 856 ms
83,892 KB
testcase_12 AC 911 ms
79,844 KB
testcase_13 AC 772 ms
83,228 KB
testcase_14 AC 1,156 ms
85,952 KB
testcase_15 AC 1,050 ms
84,168 KB
testcase_16 AC 175 ms
78,172 KB
testcase_17 AC 758 ms
81,964 KB
testcase_18 AC 646 ms
80,728 KB
testcase_19 AC 162 ms
78,252 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