結果

問題 No.9 モンスターのレベル上げ
ユーザー しらっ亭しらっ亭
提出日時 2015-08-15 02:45:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 8,652 KB
最終ジャッジ日時 2023-09-25 11:52:57
合計ジャッジ時間 6,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,176 KB
testcase_01 AC 17 ms
8,272 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 16 ms
8,336 KB
testcase_11 AC 246 ms
8,652 KB
testcase_12 AC 2,688 ms
8,392 KB
testcase_13 AC 235 ms
8,468 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 174 ms
8,348 KB
testcase_18 AC 151 ms
8,560 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
import itertools


def solve():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    def sim(p, mi):
        ms = list(zip(A, itertools.cycle([0])))
        heapq.heapify(ms)
        for j in range(p, p + N):
            k = j % N
            nl = ms[0][0] + B[k] // 2
            if nl >= mi:
                return float('inf')
            heapq.heapreplace(ms, (nl, ms[0][1] + 1))
        return max(m[1] for m in ms)

    mi = float('inf')
    for i in range(N):
        mi = min(mi, sim(i, mi))

    print(mi)


if __name__ == '__main__':
    solve()
0