結果

問題 No.9 モンスターのレベル上げ
ユーザー roaris
提出日時 2019-10-26 12:11:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,366 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 94,184 KB
最終ジャッジ日時 2024-09-14 05:03:46
合計ジャッジ時間 14,869 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 10**18

for i in range(N):
    pq = []
    
    for j in range(N):
        heappush(pq, (A[j], 0))
    
    for j in range(N):
        level, cnt = heappop(pq)
        level += B[(i+j)%N]//2
        cnt += 1
        heappush(pq, (level, cnt))
    
    ans = min(ans, max(cnt for _, cnt in pq))

print(ans)
0