結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー ayame_py
提出日時 2015-10-08 22:32:52
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,109 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 77,816 KB
最終ジャッジ日時 2025-12-03 17:19:01
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# coding: utf-8
import heapq
N = int(raw_input())
A = map(int, raw_input().split())
B = map(int, raw_input().split())

Aheap = []
for i in range(len(A)):
	heapq.heappush(Aheap, (A[i], 0))

B = [b/2 for b in B]

ans = int(1e9+7)
for i in range(len(B)):
	a = list(Aheap)
	for j in range(len(B)):
		lv, c = a[0]
		#print str(lv) + ' ' + str(c)
		heapq.heapreplace(a, (lv+B[(i+j)%len(B)], c+1))
		#print a
	ans=min(ans, max(c for lv, c in a))

print ans
0