結果

問題 No.9 モンスターのレベル上げ
ユーザー sotanishysotanishy
提出日時 2021-03-16 20:10:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,443 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 96,580 KB
最終ジャッジ日時 2023-08-08 03:58:29
合計ジャッジ時間 16,312 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,400 KB
testcase_01 AC 76 ms
71,252 KB
testcase_02 AC 1,443 ms
96,580 KB
testcase_03 AC 1,237 ms
91,388 KB
testcase_04 AC 721 ms
83,584 KB
testcase_05 AC 531 ms
81,540 KB
testcase_06 AC 310 ms
79,240 KB
testcase_07 AC 137 ms
78,116 KB
testcase_08 AC 350 ms
79,608 KB
testcase_09 AC 1,418 ms
96,160 KB
testcase_10 AC 78 ms
71,384 KB
testcase_11 AC 1,196 ms
90,120 KB
testcase_12 AC 1,258 ms
90,852 KB
testcase_13 AC 900 ms
85,964 KB
testcase_14 AC 1,438 ms
95,488 KB
testcase_15 AC 1,368 ms
93,764 KB
testcase_16 AC 169 ms
78,212 KB
testcase_17 AC 947 ms
87,784 KB
testcase_18 AC 761 ms
84,624 KB
testcase_19 AC 157 ms
77,908 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