結果

問題 No.9 モンスターのレベル上げ
ユーザー matsu7874matsu7874
提出日時 2015-08-16 22:42:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,745 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 8,584 KB
最終ジャッジ日時 2023-09-06 04:05:11
合計ジャッジ時間 33,259 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,096 KB
testcase_01 AC 16 ms
8,008 KB
testcase_02 AC 3,277 ms
8,532 KB
testcase_03 AC 2,567 ms
8,532 KB
testcase_04 AC 1,416 ms
8,544 KB
testcase_05 AC 956 ms
8,044 KB
testcase_06 AC 353 ms
7,924 KB
testcase_07 AC 22 ms
8,000 KB
testcase_08 AC 450 ms
8,400 KB
testcase_09 AC 3,210 ms
8,584 KB
testcase_10 AC 15 ms
8,016 KB
testcase_11 AC 3,064 ms
8,336 KB
testcase_12 AC 3,745 ms
8,460 KB
testcase_13 AC 2,949 ms
8,576 KB
testcase_14 AC 3,196 ms
8,448 KB
testcase_15 AC 2,900 ms
8,564 KB
testcase_16 AC 70 ms
8,040 KB
testcase_17 AC 1,908 ms
8,500 KB
testcase_18 AC 1,623 ms
8,464 KB
testcase_19 AC 47 ms
8,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
H = [(A[i],0) for i in range(N)]
heapq.heapify(H)
min_max_cnt = N
for i in range(N):
    h = H[:]
    max_cnt = 0
    for j in range(N):
        t = heapq.heappop(h)
        cnt = t[1]+1
        heapq.heappush(h, (B[j-i]//2+t[0], cnt))
        max_cnt = max(max_cnt, cnt)
    min_max_cnt = min(min_max_cnt, max_cnt)
print(min_max_cnt)
0