結果

問題 No.9 モンスターのレベル上げ
ユーザー AEnAEn
提出日時 2022-12-15 01:32:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,308 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 95,384 KB
最終ジャッジ日時 2023-08-08 12:28:52
合計ジャッジ時間 14,780 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,324 KB
testcase_01 AC 71 ms
71,444 KB
testcase_02 AC 1,288 ms
95,384 KB
testcase_03 AC 1,124 ms
89,500 KB
testcase_04 AC 641 ms
83,932 KB
testcase_05 AC 481 ms
81,800 KB
testcase_06 AC 283 ms
78,924 KB
testcase_07 AC 125 ms
78,256 KB
testcase_08 AC 327 ms
79,204 KB
testcase_09 AC 1,266 ms
93,416 KB
testcase_10 AC 69 ms
71,332 KB
testcase_11 AC 1,041 ms
90,812 KB
testcase_12 AC 1,025 ms
90,880 KB
testcase_13 AC 803 ms
86,016 KB
testcase_14 AC 1,308 ms
93,904 KB
testcase_15 AC 1,184 ms
92,352 KB
testcase_16 AC 155 ms
78,568 KB
testcase_17 AC 846 ms
87,096 KB
testcase_18 AC 711 ms
84,588 KB
testcase_19 AC 155 ms
78,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

res = float('inf')
for i in range(N):
    h = []
    cnt = 0
    for j in range(N):
        heappush(h,(A[j],0))
    for j in range(N):
        b = B[(i+j)%N]
        lev, num = heappop(h)
        cnt = max(cnt,num+1)
        heappush(h,(lev+b//2,num+1))
    res = min(res, cnt)
print(res)

0