結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー pessimist
提出日時 2025-06-08 18:21:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 614 ms / 5,000 ms
+ 79µs
コード長 449 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 237 ms
コンパイル使用メモリ 95,728 KB
実行使用メモリ 88,488 KB
最終ジャッジ日時 2026-07-11 06:53:27
合計ジャッジ時間 7,792 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from heapq import heappushpop, heapify
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))*2
def solve(i):
    mask = (1<<15)-1
    q = [x << 15 for x in A]
    heapify(q)
    ret = 0
    for b in B[i:i+N]:
        x=q[0]
        lv,cnt=x>>15,x&mask
        lv+=b//2
        cnt+=1
        if ret<cnt:ret=cnt
        x=(lv<<15)+cnt
        heappushpop(q,x)
    return ret


ans=min(solve(i) for i in range(N))
print(ans)
0