結果

問題 No.9 モンスターのレベル上げ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-12 21:39:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,482 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 90,616 KB
最終ジャッジ日時 2023-09-11 02:48:46
合計ジャッジ時間 16,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,436 KB
testcase_01 AC 80 ms
71,192 KB
testcase_02 AC 1,456 ms
89,532 KB
testcase_03 AC 1,229 ms
87,388 KB
testcase_04 AC 758 ms
82,616 KB
testcase_05 AC 576 ms
81,944 KB
testcase_06 AC 314 ms
79,420 KB
testcase_07 AC 142 ms
77,844 KB
testcase_08 AC 368 ms
80,296 KB
testcase_09 AC 1,424 ms
89,652 KB
testcase_10 AC 81 ms
71,464 KB
testcase_11 AC 1,047 ms
85,516 KB
testcase_12 AC 1,114 ms
80,676 KB
testcase_13 AC 966 ms
84,636 KB
testcase_14 AC 1,482 ms
90,616 KB
testcase_15 AC 1,326 ms
88,368 KB
testcase_16 AC 181 ms
78,768 KB
testcase_17 AC 914 ms
83,480 KB
testcase_18 AC 796 ms
82,896 KB
testcase_19 AC 157 ms
78,364 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[:]
    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