結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,120 KB
testcase_01 AC 16 ms
8,124 KB
testcase_02 AC 2,114 ms
8,492 KB
testcase_03 AC 1,679 ms
8,476 KB
testcase_04 AC 896 ms
8,516 KB
testcase_05 AC 612 ms
8,368 KB
testcase_06 AC 220 ms
7,944 KB
testcase_07 AC 20 ms
8,124 KB
testcase_08 AC 291 ms
8,028 KB
testcase_09 AC 2,082 ms
8,540 KB
testcase_10 AC 17 ms
7,980 KB
testcase_11 AC 1,972 ms
8,624 KB
testcase_12 AC 2,893 ms
8,428 KB
testcase_13 AC 1,900 ms
8,568 KB
testcase_14 AC 2,073 ms
8,524 KB
testcase_15 AC 1,941 ms
8,532 KB
testcase_16 AC 49 ms
8,000 KB
testcase_17 AC 1,247 ms
8,540 KB
testcase_18 AC 1,008 ms
8,388 KB
testcase_19 AC 35 ms
8,028 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)
	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