結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2025-06-08 18:21:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,073 ms / 5,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 756 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 81,408 KB |
最終ジャッジ日時 | 2025-06-08 18:21:23 |
合計ジャッジ時間 | 12,063 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
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)