結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,212 KB
testcase_01 AC 16 ms
8,192 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,324 KB
testcase_11 AC 246 ms
8,484 KB
testcase_12 AC 2,781 ms
8,476 KB
testcase_13 AC 229 ms
8,540 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 172 ms
8,420 KB
testcase_18 AC 151 ms
8,428 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.heappushpop(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