結果

問題 No.9 モンスターのレベル上げ
ユーザー lloyzlloyz
提出日時 2023-09-28 03:03:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,040 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 87,100 KB
最終ジャッジ日時 2023-09-28 03:03:50
合計ジャッジ時間 11,607 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,420 KB
testcase_01 AC 71 ms
71,220 KB
testcase_02 AC 1,040 ms
87,100 KB
testcase_03 AC 900 ms
85,300 KB
testcase_04 AC 505 ms
80,380 KB
testcase_05 AC 377 ms
79,968 KB
testcase_06 AC 231 ms
78,824 KB
testcase_07 AC 129 ms
78,240 KB
testcase_08 AC 249 ms
79,564 KB
testcase_09 AC 1,019 ms
86,988 KB
testcase_10 AC 71 ms
71,336 KB
testcase_11 AC 765 ms
82,796 KB
testcase_12 AC 738 ms
80,552 KB
testcase_13 AC 721 ms
82,280 KB
testcase_14 AC 951 ms
86,408 KB
testcase_15 AC 934 ms
85,456 KB
testcase_16 AC 141 ms
77,920 KB
testcase_17 AC 657 ms
83,328 KB
testcase_18 AC 530 ms
81,520 KB
testcase_19 AC 128 ms
77,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

H = []
for i in range(n):
    H.append((A[i], 0))
heapify(H)
ans = 10**18
for i in range(n):
    Hc = H[:]
    for j in range(n):
        ii = (i + j) % n
        cl, cc = heappop(Hc)
        cc += 1
        cl += B[ii] // 2
        heappush(Hc, (cl, cc))
    res = 0
    for j in range(n):
        cc = Hc[j][1]
        res = max(res, cc)
    ans = min(ans, res)
print(ans)
0