結果

問題 No.9 モンスターのレベル上げ
ユーザー titiatitia
提出日時 2021-11-02 01:09:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,645 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-19 03:12:54
合計ジャッジ時間 32,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 3,372 ms
11,264 KB
testcase_03 AC 2,555 ms
11,136 KB
testcase_04 AC 1,387 ms
11,008 KB
testcase_05 AC 949 ms
11,008 KB
testcase_06 AC 332 ms
11,008 KB
testcase_07 AC 34 ms
10,880 KB
testcase_08 AC 447 ms
11,008 KB
testcase_09 AC 3,246 ms
11,136 KB
testcase_10 AC 30 ms
11,008 KB
testcase_11 AC 3,063 ms
11,136 KB
testcase_12 AC 3,645 ms
11,008 KB
testcase_13 AC 3,047 ms
11,136 KB
testcase_14 AC 3,268 ms
11,136 KB
testcase_15 AC 3,004 ms
11,136 KB
testcase_16 AC 81 ms
10,880 KB
testcase_17 AC 1,895 ms
11,136 KB
testcase_18 AC 1,566 ms
11,136 KB
testcase_19 AC 55 ms
10,880 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