結果

問題 No.9 モンスターのレベル上げ
ユーザー 👑 colognecologne
提出日時 2022-01-20 16:49:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 862 ms / 5,000 ms
コード長 540 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 81,864 KB
最終ジャッジ日時 2024-05-03 02:18:06
合計ジャッジ時間 9,727 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
54,016 KB
testcase_01 AC 33 ms
53,560 KB
testcase_02 AC 851 ms
81,532 KB
testcase_03 AC 694 ms
80,116 KB
testcase_04 AC 435 ms
78,236 KB
testcase_05 AC 306 ms
77,344 KB
testcase_06 AC 176 ms
76,804 KB
testcase_07 AC 78 ms
76,908 KB
testcase_08 AC 203 ms
77,104 KB
testcase_09 AC 838 ms
81,552 KB
testcase_10 AC 37 ms
52,824 KB
testcase_11 AC 671 ms
81,864 KB
testcase_12 AC 628 ms
78,172 KB
testcase_13 AC 597 ms
81,312 KB
testcase_14 AC 862 ms
81,612 KB
testcase_15 AC 810 ms
81,280 KB
testcase_16 AC 109 ms
76,848 KB
testcase_17 AC 541 ms
78,952 KB
testcase_18 AC 461 ms
78,648 KB
testcase_19 AC 90 ms
76,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import heapq

input = sys.stdin.readline


def main():
    N = int(input())
    *A, = map(int, input().split())
    *B, = map(int, input().split())

    ans = N

    initQ = [(a, 0) for a in A]
    heapq.heapify(initQ)

    for i in range(N):
        Q = initQ[:]
        for j in range(i, N+i):
            if j >= N:
                j -= N

            lv, bt = Q[0]
            heapq.heapreplace(Q, (lv+B[j]//2, bt+1))

        ans = min(ans, max((bt for lv, bt in Q)))

    print(ans)


if __name__ == '__main__':
    main()
0