結果

問題 No.9 モンスターのレベル上げ
ユーザー HydruHydru
提出日時 2023-01-16 14:08:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,648 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 128,384 KB
最終ジャッジ日時 2023-08-29 05:07:51
合計ジャッジ時間 38,494 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 72 ms
71,164 KB
testcase_02 AC 3,575 ms
128,196 KB
testcase_03 AC 2,784 ms
111,364 KB
testcase_04 AC 1,533 ms
92,164 KB
testcase_05 AC 1,086 ms
85,820 KB
testcase_06 AC 476 ms
80,932 KB
testcase_07 AC 139 ms
78,332 KB
testcase_08 AC 586 ms
81,700 KB
testcase_09 AC 3,497 ms
123,576 KB
testcase_10 AC 72 ms
71,356 KB
testcase_11 AC 3,127 ms
120,204 KB
testcase_12 AC 4,648 ms
111,312 KB
testcase_13 AC 4,005 ms
128,384 KB
testcase_14 AC 3,500 ms
125,328 KB
testcase_15 AC 3,192 ms
120,828 KB
testcase_16 AC 185 ms
78,116 KB
testcase_17 AC 2,088 ms
100,224 KB
testcase_18 AC 1,775 ms
94,432 KB
testcase_19 AC 161 ms
77,928 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,j) for j in range(n)]
    heapify(Q)
    cnt=[0 for _ in range(n)]
    for j in range(n):
        a,c,ind=heappop(Q)
        lv=B[(i+j)%n]//2
        cnt[ind]+=1
        heappush(Q,(a+lv,c+1,ind))
    ans=min(ans,max(cnt))

print(ans)
0