結果

問題 No.9 モンスターのレベル上げ
ユーザー ayame_pyayame_py
提出日時 2015-10-08 23:14:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,658 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-09-06 04:21:13
合計ジャッジ時間 21,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,160 KB
testcase_01 AC 16 ms
7,952 KB
testcase_02 AC 2,108 ms
8,536 KB
testcase_03 AC 1,677 ms
8,612 KB
testcase_04 AC 894 ms
8,416 KB
testcase_05 AC 608 ms
8,372 KB
testcase_06 AC 219 ms
7,964 KB
testcase_07 AC 20 ms
8,000 KB
testcase_08 AC 288 ms
7,932 KB
testcase_09 AC 2,140 ms
8,540 KB
testcase_10 AC 16 ms
8,120 KB
testcase_11 AC 1,953 ms
8,364 KB
testcase_12 AC 2,658 ms
8,512 KB
testcase_13 AC 1,851 ms
8,528 KB
testcase_14 AC 2,018 ms
8,684 KB
testcase_15 AC 1,897 ms
8,536 KB
testcase_16 AC 53 ms
7,960 KB
testcase_17 AC 1,244 ms
8,424 KB
testcase_18 AC 1,017 ms
8,520 KB
testcase_19 AC 35 ms
8,084 KB
権限があれば一括ダウンロードができます

ソースコード

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