結果

問題 No.9 モンスターのレベル上げ
ユーザー chocoruskchocorusk
提出日時 2020-09-07 13:52:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,065 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 8,732 KB
最終ジャッジ日時 2023-08-19 16:42:08
合計ジャッジ時間 37,531 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,256 KB
testcase_01 AC 17 ms
8,112 KB
testcase_02 AC 3,801 ms
8,564 KB
testcase_03 AC 2,927 ms
8,536 KB
testcase_04 AC 1,585 ms
8,432 KB
testcase_05 AC 1,079 ms
8,260 KB
testcase_06 AC 371 ms
8,352 KB
testcase_07 AC 23 ms
8,204 KB
testcase_08 AC 494 ms
8,364 KB
testcase_09 AC 3,698 ms
8,604 KB
testcase_10 AC 16 ms
8,232 KB
testcase_11 AC 3,561 ms
8,456 KB
testcase_12 AC 4,065 ms
8,532 KB
testcase_13 AC 3,360 ms
8,568 KB
testcase_14 AC 3,671 ms
8,732 KB
testcase_15 AC 3,304 ms
8,668 KB
testcase_16 AC 74 ms
8,280 KB
testcase_17 AC 2,154 ms
8,504 KB
testcase_18 AC 1,802 ms
8,296 KB
testcase_19 AC 50 ms
8,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
b=b+b
import heapq
ans=n
for i in range(n):
    que=[[x, 0] for x in a]
    heapq.heapify(que)
    for x in b[i:i+n]:
        p=heapq.heappop(que)
        heapq.heappush(que, [p[0]+x//2, p[1]+1])
    mx=0
    for p in que:
        mx=max(mx, p[1])
    ans=min(ans, mx)
print(ans)
0