結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー gigurururu
提出日時 2014-11-06 17:44:57
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,248 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 77,364 KB
最終ジャッジ日時 2025-12-03 12:56:29
ジャッジサーバーID
(参考情報)
judge5 / judge5
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import heapq

n=input()
a=map(int,raw_input().split())+[1e9]
heapq.heapify(a)
a=[(i,0) for i in a]
b=[int(i)/2 for i in raw_input().split()]

max_list=[]

for i in range(n):
    pq=a[:]
    for elevel in b[i:]+b[:i]:
        level,cnt=heapq.heappop(pq)
        heapq.heappush(pq,(level+elevel,cnt+1))
    max_list.append(max([y for x,y in pq]))

print min(max_list)
0