結果

問題 No.9 モンスターのレベル上げ
ユーザー nisizawanisizawa
提出日時 2017-12-19 13:12:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,217 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 8,676 KB
最終ジャッジ日時 2023-09-06 05:40:37
合計ジャッジ時間 13,793 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,952 KB
testcase_01 AC 16 ms
7,912 KB
testcase_02 AC 1,314 ms
8,448 KB
testcase_03 AC 575 ms
8,612 KB
testcase_04 AC 533 ms
8,524 KB
testcase_05 AC 405 ms
8,340 KB
testcase_06 AC 148 ms
8,004 KB
testcase_07 AC 18 ms
8,120 KB
testcase_08 AC 155 ms
8,392 KB
testcase_09 AC 1,174 ms
8,628 KB
testcase_10 AC 16 ms
8,088 KB
testcase_11 AC 1,281 ms
8,668 KB
testcase_12 AC 3,217 ms
8,424 KB
testcase_13 AC 27 ms
8,676 KB
testcase_14 AC 1,062 ms
8,496 KB
testcase_15 AC 1,167 ms
8,368 KB
testcase_16 AC 33 ms
8,084 KB
testcase_17 AC 812 ms
8,484 KB
testcase_18 AC 652 ms
8,436 KB
testcase_19 AC 31 ms
8,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = int(input())
a_ls = [int(a) for a in input().split()]
b_ls = [int(b) for b in input().split()]

hq_o = [(a, 0) for a in a_ls]
heapq.heapify(hq_o)

db_ls = b_ls + b_ls

ct_max_min = n
for i in range(n):
    hq = hq_o[:]
    
    ct_max = 0
    for j in range(n):
        lv, ct = hq[0]
        lv += db_ls[i + j] // 2
        ct += 1
        heapq.heapreplace(hq, (lv, ct))
        if ct > ct_max:
            ct_max = ct
        
        if ct_max >= ct_max_min:
            break

    if ct_max < ct_max_min:
        ct_max_min = ct_max

print(ct_max_min)
0