結果

問題 No.9 モンスターのレベル上げ
ユーザー chocoruskchocorusk
提出日時 2020-09-07 13:52:43
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 4,295 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 65 ms
使用メモリ 8,260 KB
最終ジャッジ日時 2023-01-05 19:31:34
合計ジャッジ時間 39,171 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 16 ms
7,912 KB
testcase_02 AC 3,868 ms
8,076 KB
testcase_03 AC 3,003 ms
8,128 KB
testcase_04 AC 1,632 ms
7,968 KB
testcase_05 AC 1,108 ms
7,916 KB
testcase_06 AC 379 ms
7,940 KB
testcase_07 AC 23 ms
7,728 KB
testcase_08 AC 512 ms
7,900 KB
testcase_09 AC 3,732 ms
8,064 KB
testcase_10 AC 16 ms
7,844 KB
testcase_11 AC 3,600 ms
8,260 KB
testcase_12 AC 4,295 ms
8,088 KB
testcase_13 AC 3,426 ms
8,212 KB
testcase_14 AC 3,800 ms
8,188 KB
testcase_15 AC 3,478 ms
8,224 KB
testcase_16 AC 78 ms
7,796 KB
testcase_17 AC 2,227 ms
8,156 KB
testcase_18 AC 1,898 ms
7,928 KB
testcase_19 AC 52 ms
7,944 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