結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー sotanishy
提出日時 2021-03-16 20:10:52
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,097 ms / 5,000 ms
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 191 ms
コンパイル使用メモリ 85,236 KB
実行使用メモリ 96,676 KB
最終ジャッジ日時 2026-05-08 15:54:54
合計ジャッジ時間 12,232 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
    heap = []
    for j in range(N):
        heappush(heap, (A[j], 0))
    for j in range(N):
        level, cnt = heappop(heap)
        level += B[(i+j)%N] // 2
        cnt += 1
        heappush(heap, (level, cnt))
    ans = min(ans, max(cnt for val, cnt in heap))
print(ans)
0