結果

問題 No.9 モンスターのレベル上げ
ユーザー yaoshimax
提出日時 2015-02-09 17:56:53
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 392 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-06-23 16:31:00
合計ジャッジ時間 43,780 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush,heappop,heapify
N=int(raw_input())
A=map(int, raw_input().split())
B=map(int, raw_input().split())

ans = N
for i in xrange(N):
   curB=B[i:]+B[:i]
   curAns = 0
   pq = zip(A,[0 for i in range(N)])
   heapify(pq)
   for b in curB:
      level,num=heappop(pq)
      heappush(pq,(level+b/2,num+1))
      curAns = max(curAns,num+1)
   ans = min(ans,curAns)
print ans
0