結果

問題 No.9 モンスターのレベル上げ
ユーザー HydruHydru
提出日時 2023-01-16 14:13:12
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,378 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 94,264 KB
最終ジャッジ日時 2023-08-29 05:41:27
合計ジャッジ時間 15,586 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,276 KB
testcase_01 AC 74 ms
71,184 KB
testcase_02 AC 1,360 ms
94,108 KB
testcase_03 AC 1,109 ms
89,884 KB
testcase_04 AC 693 ms
83,776 KB
testcase_05 AC 533 ms
82,120 KB
testcase_06 AC 317 ms
79,168 KB
testcase_07 AC 132 ms
78,452 KB
testcase_08 AC 350 ms
79,692 KB
testcase_09 AC 1,378 ms
93,852 KB
testcase_10 AC 76 ms
71,216 KB
testcase_11 AC 994 ms
88,600 KB
testcase_12 AC 965 ms
87,440 KB
testcase_13 AC 904 ms
87,512 KB
testcase_14 AC 1,355 ms
94,264 KB
testcase_15 AC 1,274 ms
91,764 KB
testcase_16 AC 174 ms
78,124 KB
testcase_17 AC 879 ms
85,968 KB
testcase_18 AC 746 ms
83,920 KB
testcase_19 AC 146 ms
78,344 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