結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,104 KB
testcase_01 AC 18 ms
7,996 KB
testcase_02 AC 2,149 ms
8,556 KB
testcase_03 AC 1,644 ms
8,684 KB
testcase_04 AC 896 ms
8,504 KB
testcase_05 AC 604 ms
7,956 KB
testcase_06 AC 217 ms
7,916 KB
testcase_07 AC 21 ms
7,996 KB
testcase_08 AC 294 ms
8,116 KB
testcase_09 AC 2,090 ms
8,632 KB
testcase_10 AC 17 ms
7,940 KB
testcase_11 AC 1,990 ms
8,344 KB
testcase_12 AC 2,616 ms
8,380 KB
testcase_13 AC 1,834 ms
8,644 KB
testcase_14 AC 2,082 ms
8,508 KB
testcase_15 AC 1,909 ms
8,492 KB
testcase_16 AC 50 ms
8,072 KB
testcase_17 AC 1,239 ms
8,424 KB
testcase_18 AC 1,023 ms
8,360 KB
testcase_19 AC 35 ms
8,004 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]
# heapq.heapify(H)
min_max_cnt = N
for i in range(N):
    h = H[:]
    for b in B[N-i:2*N-i]:
        # print(h)
        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(h)

print(min_max_cnt)
0