結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,960 KB
testcase_01 AC 18 ms
8,020 KB
testcase_02 AC 2,103 ms
8,580 KB
testcase_03 AC 1,664 ms
8,524 KB
testcase_04 AC 891 ms
8,404 KB
testcase_05 AC 597 ms
8,524 KB
testcase_06 AC 218 ms
7,972 KB
testcase_07 AC 20 ms
8,020 KB
testcase_08 AC 281 ms
7,992 KB
testcase_09 AC 2,082 ms
8,560 KB
testcase_10 AC 16 ms
7,960 KB
testcase_11 AC 1,950 ms
8,336 KB
testcase_12 AC 2,611 ms
8,520 KB
testcase_13 AC 1,847 ms
8,648 KB
testcase_14 AC 2,055 ms
8,568 KB
testcase_15 AC 1,917 ms
8,616 KB
testcase_16 AC 49 ms
8,128 KB
testcase_17 AC 1,210 ms
8,488 KB
testcase_18 AC 1,022 ms
8,444 KB
testcase_19 AC 35 ms
7,972 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 = list(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