結果

問題 No.9 モンスターのレベル上げ
ユーザー colognecologne
提出日時 2022-01-20 16:49:56
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,035 ms / 5,000 ms
コード長 540 bytes
コンパイル時間 264 ms
使用メモリ 88,088 KB
最終ジャッジ日時 2022-12-28 20:28:57
合計ジャッジ時間 12,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 79 ms
75,608 KB
testcase_01 AC 79 ms
75,832 KB
testcase_02 AC 1,035 ms
87,780 KB
testcase_03 AC 834 ms
86,276 KB
testcase_04 AC 520 ms
84,680 KB
testcase_05 AC 397 ms
83,504 KB
testcase_06 AC 239 ms
82,672 KB
testcase_07 AC 126 ms
82,016 KB
testcase_08 AC 271 ms
83,100 KB
testcase_09 AC 1,000 ms
87,212 KB
testcase_10 AC 77 ms
75,712 KB
testcase_11 AC 817 ms
88,088 KB
testcase_12 AC 860 ms
84,308 KB
testcase_13 AC 719 ms
86,696 KB
testcase_14 AC 987 ms
87,456 KB
testcase_15 AC 949 ms
86,976 KB
testcase_16 AC 152 ms
82,248 KB
testcase_17 AC 652 ms
85,220 KB
testcase_18 AC 567 ms
84,596 KB
testcase_19 AC 139 ms
81,820 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