結果

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

ソースコード

diff #

import heapq
N = int(raw_input())
A = map(int, raw_input().split())
B = [int(x)//2 for x in raw_input().split()] * 2
A.sort()
Aheap = [(a, 0) for a in A]

ans = N
for i in range(N):
	a = list(Aheap)
	ansc = 0
	for j in B[i:i+N]:
		lv, c = a[0]
		heapq.heapreplace(a, (lv+j, c+1))
	ansc=max(c for lv, c in a)
	if ans > ansc:
		ans = ansc

print ans
0