結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,912 KB
testcase_01 AC 16 ms
7,944 KB
testcase_02 AC 1,204 ms
8,584 KB
testcase_03 AC 527 ms
8,624 KB
testcase_04 AC 523 ms
8,520 KB
testcase_05 AC 383 ms
8,324 KB
testcase_06 AC 136 ms
8,108 KB
testcase_07 AC 18 ms
8,156 KB
testcase_08 AC 148 ms
8,400 KB
testcase_09 AC 1,069 ms
8,552 KB
testcase_10 AC 17 ms
8,132 KB
testcase_11 AC 1,136 ms
8,696 KB
testcase_12 AC 3,072 ms
8,292 KB
testcase_13 AC 38 ms
8,644 KB
testcase_14 AC 1,064 ms
8,708 KB
testcase_15 AC 1,112 ms
8,412 KB
testcase_16 AC 34 ms
7,972 KB
testcase_17 AC 753 ms
8,400 KB
testcase_18 AC 625 ms
8,428 KB
testcase_19 AC 30 ms
7,984 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 b in db_ls[i:i + n]:
        lv, ct = hq[0]
        lv += b // 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