結果

問題 No.9 モンスターのレベル上げ
ユーザー nsd_fbnsd_fb
提出日時 2015-02-19 04:59:07
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,157 ms / 5,000 ms
コード長 532 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 77,464 KB
実行使用メモリ 89,244 KB
最終ジャッジ日時 2023-09-06 03:40:42
合計ジャッジ時間 13,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
78,148 KB
testcase_01 AC 79 ms
78,056 KB
testcase_02 AC 1,120 ms
89,244 KB
testcase_03 AC 948 ms
87,896 KB
testcase_04 AC 640 ms
84,076 KB
testcase_05 AC 480 ms
82,732 KB
testcase_06 AC 307 ms
81,992 KB
testcase_07 AC 140 ms
80,532 KB
testcase_08 AC 324 ms
82,512 KB
testcase_09 AC 1,126 ms
88,452 KB
testcase_10 AC 78 ms
77,996 KB
testcase_11 AC 831 ms
86,160 KB
testcase_12 AC 896 ms
82,892 KB
testcase_13 AC 759 ms
86,208 KB
testcase_14 AC 1,157 ms
89,008 KB
testcase_15 AC 1,105 ms
88,484 KB
testcase_16 AC 184 ms
81,692 KB
testcase_17 AC 791 ms
85,528 KB
testcase_18 AC 677 ms
83,832 KB
testcase_19 AC 171 ms
81,168 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