結果

問題 No.9 モンスターのレベル上げ
ユーザー matsu7874matsu7874
提出日時 2015-08-17 19:13:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,529 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 8,676 KB
最終ジャッジ日時 2023-09-06 04:13:41
合計ジャッジ時間 21,480 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,008 KB
testcase_01 AC 16 ms
8,060 KB
testcase_02 AC 2,046 ms
8,676 KB
testcase_03 AC 1,633 ms
8,584 KB
testcase_04 AC 867 ms
8,392 KB
testcase_05 AC 593 ms
8,452 KB
testcase_06 AC 212 ms
7,976 KB
testcase_07 AC 18 ms
7,956 KB
testcase_08 AC 279 ms
7,996 KB
testcase_09 AC 2,102 ms
8,516 KB
testcase_10 AC 15 ms
7,972 KB
testcase_11 AC 1,904 ms
8,492 KB
testcase_12 AC 2,529 ms
8,424 KB
testcase_13 AC 1,843 ms
8,520 KB
testcase_14 AC 2,035 ms
8,544 KB
testcase_15 AC 1,855 ms
8,488 KB
testcase_16 AC 49 ms
7,964 KB
testcase_17 AC 1,199 ms
8,532 KB
testcase_18 AC 987 ms
8,352 KB
testcase_19 AC 35 ms
8,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

min_max_cnt = N
for i in range(N):
    h = H[:]
    for b in B[i:i+N]:
        s,t = h[0]
        heapq.heapreplace(h, (b+s, t+1))
    max_cnt = max(t for s,t in h)
    if min_max_cnt > max_cnt:
        min_max_cnt = max_cnt

print(min_max_cnt)
0