結果

問題 No.9 モンスターのレベル上げ
ユーザー ryusukeryusuke
提出日時 2022-02-05 17:07:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,148 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 91,672 KB
最終ジャッジ日時 2023-09-02 06:48:05
合計ジャッジ時間 23,665 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,444 KB
testcase_01 AC 79 ms
71,292 KB
testcase_02 AC 2,148 ms
91,512 KB
testcase_03 AC 1,830 ms
88,044 KB
testcase_04 AC 1,050 ms
82,764 KB
testcase_05 AC 770 ms
81,316 KB
testcase_06 AC 414 ms
79,256 KB
testcase_07 AC 161 ms
78,496 KB
testcase_08 AC 475 ms
79,764 KB
testcase_09 AC 2,106 ms
91,256 KB
testcase_10 AC 78 ms
71,224 KB
testcase_11 AC 1,909 ms
89,492 KB
testcase_12 AC 2,017 ms
91,672 KB
testcase_13 AC 1,546 ms
86,588 KB
testcase_14 AC 2,144 ms
90,540 KB
testcase_15 AC 1,975 ms
89,216 KB
testcase_16 AC 208 ms
78,368 KB
testcase_17 AC 1,356 ms
85,236 KB
testcase_18 AC 1,161 ms
83,716 KB
testcase_19 AC 171 ms
77,900 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