結果

問題 No.9 モンスターのレベル上げ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-12 21:42:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,222 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 88,192 KB
最終ジャッジ日時 2023-09-11 02:51:45
合計ジャッジ時間 13,221 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,344 KB
testcase_01 AC 77 ms
71,392 KB
testcase_02 AC 1,157 ms
86,760 KB
testcase_03 AC 969 ms
85,300 KB
testcase_04 AC 603 ms
81,004 KB
testcase_05 AC 455 ms
80,104 KB
testcase_06 AC 273 ms
78,424 KB
testcase_07 AC 130 ms
78,196 KB
testcase_08 AC 296 ms
78,840 KB
testcase_09 AC 1,159 ms
86,460 KB
testcase_10 AC 76 ms
71,256 KB
testcase_11 AC 860 ms
83,716 KB
testcase_12 AC 908 ms
80,376 KB
testcase_13 AC 790 ms
82,588 KB
testcase_14 AC 1,222 ms
88,192 KB
testcase_15 AC 1,055 ms
86,200 KB
testcase_16 AC 155 ms
78,116 KB
testcase_17 AC 745 ms
82,804 KB
testcase_18 AC 682 ms
82,784 KB
testcase_19 AC 142 ms
77,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B = [b//2 for b in B]
B += B
ans = 10**10
base = [(a,0) for a in A]
heapify(base)
for i in range(n):

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