結果

問題 No.9 モンスターのレベル上げ
ユーザー titiatitia
提出日時 2021-11-02 01:08:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-19 03:11:21
合計ジャッジ時間 33,994 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 31 ms
10,752 KB
testcase_11 AC 3,253 ms
11,264 KB
testcase_12 AC 3,813 ms
11,008 KB
testcase_13 AC 3,288 ms
11,136 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,896 ms
11,008 KB
testcase_18 AC 1,606 ms
11,008 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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