結果

問題 No.9 モンスターのレベル上げ
ユーザー nsd_fbnsd_fb
提出日時 2015-02-19 04:56:48
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 531 bytes
コンパイル時間 63 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2023-01-21 12:39:21
合計ジャッジ時間 41,202 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 12 ms
6,392 KB
testcase_01 AC 11 ms
6,260 KB
testcase_02 AC 4,047 ms
6,452 KB
testcase_03 AC 3,182 ms
6,952 KB
testcase_04 AC 1,698 ms
6,584 KB
testcase_05 AC 1,132 ms
6,368 KB
testcase_06 AC 401 ms
6,328 KB
testcase_07 AC 19 ms
6,548 KB
testcase_08 AC 533 ms
6,468 KB
testcase_09 AC 3,974 ms
6,724 KB
testcase_10 AC 11 ms
6,548 KB
testcase_11 AC 3,737 ms
6,448 KB
testcase_12 TLE -
testcase_13 AC 3,764 ms
6,748 KB
testcase_14 AC 3,941 ms
6,616 KB
testcase_15 AC 3,592 ms
6,696 KB
testcase_16 AC 76 ms
6,360 KB
testcase_17 AC 2,333 ms
6,952 KB
testcase_18 AC 1,940 ms
6,512 KB
testcase_19 AC 48 ms
6,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = input()
a = map(int, raw_input().split())
b = map(int, raw_input().split())

init = []
for level in a:
    init.append((level, 0))

heapq.heapify(init)
ans = float("inf")

for offset in xrange(-n, 0):
    queue = list(init)

    for i in xrange(offset, offset + n):
        level, battle = heapq.heappop(queue)
        heapq.heappush(queue, (level + b[i] // 2, battle + 1))

    max_battle = 0
    for level, battle in queue:
        max_battle = max(max_battle, battle)

    ans = min(ans, max_battle)

print ans
0