結果

問題 No.9 モンスターのレベル上げ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-10 09:06:26
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,092 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 329 ms
使用メモリ 91,416 KB
最終ジャッジ日時 2023-01-21 22:41:21
合計ジャッジ時間 13,096 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 113 ms
76,896 KB
testcase_01 AC 111 ms
76,956 KB
testcase_02 AC 1,062 ms
90,740 KB
testcase_03 AC 929 ms
89,364 KB
testcase_04 AC 593 ms
85,240 KB
testcase_05 AC 457 ms
85,712 KB
testcase_06 AC 311 ms
83,800 KB
testcase_07 AC 167 ms
83,312 KB
testcase_08 AC 320 ms
83,716 KB
testcase_09 AC 1,089 ms
90,336 KB
testcase_10 AC 108 ms
76,900 KB
testcase_11 AC 816 ms
88,076 KB
testcase_12 AC 754 ms
85,464 KB
testcase_13 AC 731 ms
88,004 KB
testcase_14 AC 1,092 ms
91,416 KB
testcase_15 AC 1,003 ms
90,068 KB
testcase_16 AC 191 ms
83,172 KB
testcase_17 AC 726 ms
87,592 KB
testcase_18 AC 619 ms
86,252 KB
testcase_19 AC 178 ms
83,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline


N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B += B
Y = [(b,0) for b in A]
heapify(Y)
ans = N
for i in range(N):
    
    h = Y[:]
    tans = 0
    for j in range(N):
        
        a = B[i+j]
        x,c = heappop(h)
        x += a//2
        c += 1
        tans = max(tans,c)
        heappush(h,(x,c))
    ans = min(ans,tans)
print(ans)
0