結果

問題 No.9 モンスターのレベル上げ
ユーザー ryusukeryusuke
提出日時 2022-02-05 17:07:43
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 2,249 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 311 ms
使用メモリ 96,520 KB
最終ジャッジ日時 2023-01-18 11:02:08
合計ジャッジ時間 24,364 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 98 ms
75,436 KB
testcase_01 AC 96 ms
75,784 KB
testcase_02 AC 2,237 ms
96,520 KB
testcase_03 AC 1,905 ms
92,720 KB
testcase_04 AC 1,111 ms
87,184 KB
testcase_05 AC 816 ms
85,632 KB
testcase_06 AC 466 ms
84,272 KB
testcase_07 AC 188 ms
82,500 KB
testcase_08 AC 520 ms
84,760 KB
testcase_09 AC 2,209 ms
95,240 KB
testcase_10 AC 93 ms
75,732 KB
testcase_11 AC 1,945 ms
94,876 KB
testcase_12 AC 2,067 ms
95,656 KB
testcase_13 AC 1,573 ms
90,700 KB
testcase_14 AC 2,249 ms
95,628 KB
testcase_15 AC 2,069 ms
94,096 KB
testcase_16 AC 237 ms
82,288 KB
testcase_17 AC 1,424 ms
89,236 KB
testcase_18 AC 1,290 ms
88,200 KB
testcase_19 AC 211 ms
82,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

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

ans = []
for start in range(n):
    q = []
    heapify(q)
    for i in range(n):
        heappush(q, (a[i], 0))
    
    for i in range(n):
        p, num = heappop(q)
        p += b[(start + i) % n] // 2
        heappush(q, (p, num + 1))

    ma = 0
    for i in range(n):
        ma = max(ma, heappop(q)[1])
    
    ans.append(ma)

print(min(ans))
0