結果

問題 No.9 モンスターのレベル上げ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-10 09:06:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,070 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 88,692 KB
最終ジャッジ日時 2023-09-06 10:07:11
合計ジャッジ時間 12,283 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
72,768 KB
testcase_01 AC 96 ms
72,848 KB
testcase_02 AC 1,070 ms
87,296 KB
testcase_03 AC 920 ms
86,280 KB
testcase_04 AC 570 ms
83,292 KB
testcase_05 AC 418 ms
82,220 KB
testcase_06 AC 269 ms
81,116 KB
testcase_07 AC 143 ms
79,880 KB
testcase_08 AC 285 ms
81,012 KB
testcase_09 AC 986 ms
88,400 KB
testcase_10 AC 90 ms
72,896 KB
testcase_11 AC 772 ms
85,712 KB
testcase_12 AC 708 ms
82,052 KB
testcase_13 AC 682 ms
85,040 KB
testcase_14 AC 1,065 ms
88,692 KB
testcase_15 AC 956 ms
87,112 KB
testcase_16 AC 165 ms
80,568 KB
testcase_17 AC 709 ms
84,044 KB
testcase_18 AC 574 ms
83,544 KB
testcase_19 AC 155 ms
79,876 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