結果

問題 No.9 モンスターのレベル上げ
ユーザー matsu7874matsu7874
提出日時 2015-08-16 22:40:10
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 3,747 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-09-06 04:02:42
合計ジャッジ時間 33,745 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,848 KB
testcase_01 AC 18 ms
7,960 KB
testcase_02 AC 3,342 ms
8,560 KB
testcase_03 AC 2,776 ms
8,552 KB
testcase_04 AC 1,375 ms
8,304 KB
testcase_05 AC 990 ms
8,368 KB
testcase_06 AC 336 ms
8,084 KB
testcase_07 AC 23 ms
8,100 KB
testcase_08 AC 442 ms
8,372 KB
testcase_09 AC 3,192 ms
8,580 KB
testcase_10 AC 16 ms
7,968 KB
testcase_11 AC 3,044 ms
8,340 KB
testcase_12 AC 3,747 ms
8,096 KB
testcase_13 AC 2,917 ms
8,536 KB
testcase_14 AC 3,157 ms
8,684 KB
testcase_15 AC 2,868 ms
8,532 KB
testcase_16 AC 68 ms
7,992 KB
testcase_17 AC 1,903 ms
8,428 KB
testcase_18 AC 1,601 ms
8,520 KB
testcase_19 AC 46 ms
7,924 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