結果

問題 No.9 モンスターのレベル上げ
ユーザー rin204rin204
提出日時 2022-06-12 15:51:08
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,235 ms / 5,000 ms
コード長 419 bytes
コンパイル時間 295 ms
使用メモリ 96,892 KB
最終ジャッジ日時 2022-11-22 19:12:07
合計ジャッジ時間 14,778 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 79 ms
75,776 KB
testcase_01 AC 80 ms
75,764 KB
testcase_02 AC 1,235 ms
95,156 KB
testcase_03 AC 1,083 ms
93,396 KB
testcase_04 AC 674 ms
87,864 KB
testcase_05 AC 529 ms
86,580 KB
testcase_06 AC 342 ms
83,680 KB
testcase_07 AC 152 ms
82,256 KB
testcase_08 AC 361 ms
84,324 KB
testcase_09 AC 1,215 ms
94,316 KB
testcase_10 AC 80 ms
75,848 KB
testcase_11 AC 907 ms
90,992 KB
testcase_12 AC 881 ms
89,708 KB
testcase_13 AC 808 ms
90,292 KB
testcase_14 AC 1,216 ms
96,892 KB
testcase_15 AC 1,109 ms
94,632 KB
testcase_16 AC 195 ms
82,952 KB
testcase_17 AC 836 ms
90,452 KB
testcase_18 AC 726 ms
88,004 KB
testcase_19 AC 173 ms
82,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
ans = 1 << 30
for i in range(n):
    hq = [(a, 0) for a in A]
    max_ = 0
    for j in range(i, i + n):
        if j >= n:
            j -= n
        a, t = heappop(hq)
        t += 1
        a += B[j] // 2
        max_ = max(max_, t)
        heappush(hq, (a, t))
    ans = min(ans, max_)
print(ans)
0