結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー ayame_py
提出日時 2015-10-08 22:41:37
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,053 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 78,032 KB
最終ジャッジ日時 2025-12-03 17:19:38
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 = [int(b)/2 for b in B]
B_ = list(B)
B.extend(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], c+1))
		#print a
	ans=min(ans, max(c for lv, c in a))

print ans
0