結果

問題 No.9 モンスターのレベル上げ
ユーザー 👑 matsu7874matsu7874
提出日時 2015-08-16 22:40:10
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 3,962 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 58 ms
使用メモリ 8,188 KB
最終ジャッジ日時 2023-01-21 14:50:59
合計ジャッジ時間 34,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,652 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 3,473 ms
8,008 KB
testcase_03 AC 2,744 ms
8,128 KB
testcase_04 AC 1,464 ms
8,012 KB
testcase_05 AC 979 ms
7,908 KB
testcase_06 AC 352 ms
7,740 KB
testcase_07 AC 21 ms
7,776 KB
testcase_08 AC 469 ms
7,752 KB
testcase_09 AC 3,255 ms
8,140 KB
testcase_10 AC 16 ms
7,876 KB
testcase_11 AC 3,253 ms
8,044 KB
testcase_12 AC 3,962 ms
8,032 KB
testcase_13 AC 3,045 ms
8,080 KB
testcase_14 AC 3,340 ms
8,124 KB
testcase_15 AC 3,087 ms
8,000 KB
testcase_16 AC 70 ms
7,804 KB
testcase_17 AC 1,952 ms
8,008 KB
testcase_18 AC 1,710 ms
8,188 KB
testcase_19 AC 49 ms
7,796 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)
        heapq.heappush(h, (B[j-i]//2+t[0],t[1]+1))
        max_cnt = max(max_cnt, t[1]+1)
    min_max_cnt = min(min_max_cnt, max_cnt)
print(min_max_cnt)
0