結果

問題 No.9 モンスターのレベル上げ
ユーザー 👑 colognecologne
提出日時 2022-01-20 16:49:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 935 ms / 5,000 ms
コード長 540 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 83,952 KB
最終ジャッジ日時 2023-08-15 14:57:29
合計ジャッジ時間 11,040 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,540 KB
testcase_01 AC 70 ms
71,404 KB
testcase_02 AC 926 ms
83,952 KB
testcase_03 AC 755 ms
81,788 KB
testcase_04 AC 460 ms
80,732 KB
testcase_05 AC 349 ms
79,084 KB
testcase_06 AC 210 ms
78,452 KB
testcase_07 AC 107 ms
77,996 KB
testcase_08 AC 234 ms
79,164 KB
testcase_09 AC 935 ms
83,692 KB
testcase_10 AC 69 ms
71,564 KB
testcase_11 AC 765 ms
83,920 KB
testcase_12 AC 700 ms
79,852 KB
testcase_13 AC 657 ms
82,356 KB
testcase_14 AC 903 ms
83,040 KB
testcase_15 AC 863 ms
82,852 KB
testcase_16 AC 132 ms
78,192 KB
testcase_17 AC 581 ms
80,852 KB
testcase_18 AC 514 ms
80,484 KB
testcase_19 AC 121 ms
78,132 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