結果

問題 No.9 モンスターのレベル上げ
ユーザー taisuketaisuke
提出日時 2023-02-20 14:04:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,436 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 8,748 KB
最終ジャッジ日時 2023-09-28 12:27:23
合計ジャッジ時間 40,954 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,032 KB
testcase_01 AC 17 ms
8,004 KB
testcase_02 AC 4,105 ms
8,704 KB
testcase_03 AC 3,208 ms
8,584 KB
testcase_04 AC 1,715 ms
8,324 KB
testcase_05 AC 1,181 ms
8,480 KB
testcase_06 AC 407 ms
7,980 KB
testcase_07 AC 24 ms
7,964 KB
testcase_08 AC 543 ms
8,012 KB
testcase_09 AC 3,978 ms
8,728 KB
testcase_10 AC 17 ms
7,964 KB
testcase_11 AC 3,851 ms
8,360 KB
testcase_12 AC 4,436 ms
8,548 KB
testcase_13 AC 3,639 ms
8,612 KB
testcase_14 AC 4,018 ms
8,748 KB
testcase_15 AC 3,629 ms
8,584 KB
testcase_16 AC 78 ms
8,108 KB
testcase_17 AC 2,352 ms
8,532 KB
testcase_18 AC 1,961 ms
8,444 KB
testcase_19 AC 54 ms
8,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b *= 2

ans = n
for i in range(n):
    que = [[a[x], 0] for x in range(n)]
    heapq.heapify(que)
    cnt = 0
    for j in range(n):
        pos = i + j
        h = heapq.heappop(que)
        h[0] += b[pos] // 2
        h[1] += 1
        heapq.heappush(que, h)
        cnt = max(cnt, h[1])
    ans = min(ans, cnt)

print(ans)
0