結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー Navier_Boltzmann
提出日時 2022-10-10 09:06:26
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 731 ms / 5,000 ms
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 168 ms
コンパイル使用メモリ 85,072 KB
実行使用メモリ 88,796 KB
最終ジャッジ日時 2026-03-10 02:59:49
合計ジャッジ時間 7,750 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline


N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B += B
Y = [(b,0) for b in A]
heapify(Y)
ans = N
for i in range(N):
    
    h = Y[:]
    tans = 0
    for j in range(N):
        
        a = B[i+j]
        x,c = heappop(h)
        x += a//2
        c += 1
        tans = max(tans,c)
        heappush(h,(x,c))
    ans = min(ans,tans)
print(ans)
0