結果

問題 No.9 モンスターのレベル上げ
ユーザー sotanishysotanishy
提出日時 2021-03-16 20:10:52
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,395 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 277 ms
使用メモリ 100,916 KB
最終ジャッジ日時 2022-12-14 17:51:27
合計ジャッジ時間 16,545 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 84 ms
75,484 KB
testcase_01 AC 85 ms
75,820 KB
testcase_02 AC 1,395 ms
100,420 KB
testcase_03 AC 1,223 ms
96,232 KB
testcase_04 AC 721 ms
87,756 KB
testcase_05 AC 518 ms
85,848 KB
testcase_06 AC 320 ms
83,452 KB
testcase_07 AC 146 ms
82,500 KB
testcase_08 AC 352 ms
84,092 KB
testcase_09 AC 1,380 ms
100,260 KB
testcase_10 AC 78 ms
75,592 KB
testcase_11 AC 1,125 ms
95,016 KB
testcase_12 AC 1,110 ms
94,756 KB
testcase_13 AC 874 ms
89,652 KB
testcase_14 AC 1,380 ms
100,916 KB
testcase_15 AC 1,324 ms
98,568 KB
testcase_16 AC 185 ms
82,996 KB
testcase_17 AC 926 ms
91,944 KB
testcase_18 AC 753 ms
89,192 KB
testcase_19 AC 164 ms
82,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
    heap = []
    for j in range(N):
        heappush(heap, (A[j], 0))
    for j in range(N):
        level, cnt = heappop(heap)
        level += B[(i+j)%N] // 2
        cnt += 1
        heappush(heap, (level, cnt))
    ans = min(ans, max(cnt for val, cnt in heap))
print(ans)
0