結果

問題 No.9 モンスターのレベル上げ
ユーザー titiatitia
提出日時 2021-11-02 01:09:20
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 3,440 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 66 ms
使用メモリ 8,204 KB
最終ジャッジ日時 2022-12-03 17:20:31
合計ジャッジ時間 32,080 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 16 ms
7,648 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 3,265 ms
8,160 KB
testcase_03 AC 2,424 ms
8,204 KB
testcase_04 AC 1,318 ms
8,168 KB
testcase_05 AC 898 ms
7,992 KB
testcase_06 AC 319 ms
7,844 KB
testcase_07 AC 21 ms
7,788 KB
testcase_08 AC 425 ms
7,776 KB
testcase_09 AC 3,162 ms
8,060 KB
testcase_10 AC 16 ms
7,820 KB
testcase_11 AC 2,859 ms
8,100 KB
testcase_12 AC 3,440 ms
8,140 KB
testcase_13 AC 2,791 ms
8,132 KB
testcase_14 AC 3,161 ms
8,064 KB
testcase_15 AC 2,885 ms
8,152 KB
testcase_16 AC 67 ms
7,716 KB
testcase_17 AC 1,808 ms
8,004 KB
testcase_18 AC 1,534 ms
8,012 KB
testcase_19 AC 46 ms
7,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

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

H=[]
for a in A:
    H.append([a,0])

def calc(H,B):
    heapq.heapify(H)
    ANS=0

    for b in B:
        x,y=heapq.heappop(H)

        x+=b//2
        y+=1
        ANS=max(ANS,y)

        heapq.heappush(H,[x,y])

    return ANS

ANS=1<<60
for i in range(N):
    ANS=min(ANS,calc(H[:],B[i:]+B[:i]))

print(ANS)
0