結果

問題 No.9 モンスターのレベル上げ
ユーザー ayame_py
提出日時 2015-10-08 23:20:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,625 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-06-23 23:13:03
合計ジャッジ時間 26,596 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 = list(Aheap)
	ansc = 0
	for j in B[i:i+N]:
		lv, c = a[0]
		heapq.heapreplace(a, (lv+j, c+1))
		if ansc < c+1: ansc = c+1
	if ans > ansc: ans = ansc

print(ans)
0