結果

問題 No.9 モンスターのレベル上げ
ユーザー ayame_py
提出日時 2015-10-08 23:14:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,256 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-23 23:10:51
合計ジャッジ時間 25,841 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = N
for i in range(N):
	a = Aheap[:]
	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