結果

問題 No.9 モンスターのレベル上げ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-12 21:40:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,490 ms / 5,000 ms
コード長 395 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 86,668 KB
実行使用メモリ 90,692 KB
最終ジャッジ日時 2023-09-11 02:49:54
合計ジャッジ時間 16,331 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,200 KB
testcase_01 AC 78 ms
71,280 KB
testcase_02 AC 1,478 ms
89,652 KB
testcase_03 AC 1,236 ms
87,636 KB
testcase_04 AC 738 ms
82,668 KB
testcase_05 AC 562 ms
81,940 KB
testcase_06 AC 313 ms
79,152 KB
testcase_07 AC 138 ms
78,228 KB
testcase_08 AC 361 ms
80,172 KB
testcase_09 AC 1,413 ms
89,540 KB
testcase_10 AC 80 ms
71,432 KB
testcase_11 AC 1,053 ms
85,380 KB
testcase_12 AC 1,117 ms
80,408 KB
testcase_13 AC 975 ms
84,676 KB
testcase_14 AC 1,490 ms
90,692 KB
testcase_15 AC 1,337 ms
88,032 KB
testcase_16 AC 180 ms
78,528 KB
testcase_17 AC 919 ms
83,704 KB
testcase_18 AC 800 ms
82,784 KB
testcase_19 AC 159 ms
78,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify

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

ans = 10**10
base = [(a,0) for a in A]
for i in range(n):

    h = base.copy()
    heapify(h)
    for j in range(n):
        a,num = heappop(h)
        a += B[(i+j)%n]//2
        heappush(h, (a,num+1))
    m = max(i for _,i in h)
    ans = min(ans,m)
print(ans)
0