結果

問題 No.9 モンスターのレベル上げ
ユーザー ayame_py
提出日時 2015-10-08 22:41:37
言語 Python2
(2.7.18)
結果
AC  
実行時間 4,665 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-06-23 23:09:24
合計ジャッジ時間 34,972 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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