結果

問題 No.9 モンスターのレベル上げ
ユーザー HydruHydru
提出日時 2023-01-16 14:13:12
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,471 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 272 ms
使用メモリ 98,704 KB
最終ジャッジ日時 2023-01-16 14:13:29
合計ジャッジ時間 16,372 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 91 ms
75,904 KB
testcase_01 AC 91 ms
75,792 KB
testcase_02 AC 1,471 ms
98,008 KB
testcase_03 AC 1,225 ms
94,152 KB
testcase_04 AC 782 ms
87,896 KB
testcase_05 AC 566 ms
85,624 KB
testcase_06 AC 346 ms
83,180 KB
testcase_07 AC 155 ms
82,668 KB
testcase_08 AC 396 ms
84,340 KB
testcase_09 AC 1,467 ms
98,704 KB
testcase_10 AC 89 ms
75,460 KB
testcase_11 AC 1,057 ms
93,048 KB
testcase_12 AC 1,030 ms
91,324 KB
testcase_13 AC 942 ms
92,396 KB
testcase_14 AC 1,470 ms
98,192 KB
testcase_15 AC 1,335 ms
95,552 KB
testcase_16 AC 206 ms
82,724 KB
testcase_17 AC 970 ms
89,868 KB
testcase_18 AC 799 ms
87,564 KB
testcase_19 AC 174 ms
82,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from heapq import heapify,heappop,heappush

inf=float("inf")
ans=inf
for i in range(n):
    Q=[(A[j],0) for j in range(n)]
    heapify(Q)
    max_cnt=0
    for j in range(n):
        a,c=heappop(Q)
        max_cnt=max(max_cnt,c+1)
        heappush(Q,(a+B[(i+j)%n]//2,c+1))
    ans=min(ans,max_cnt)

print(ans)
0