結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,136 KB
testcase_01 AC 16 ms
8,044 KB
testcase_02 AC 1,542 ms
8,612 KB
testcase_03 AC 724 ms
8,620 KB
testcase_04 AC 679 ms
8,504 KB
testcase_05 AC 510 ms
8,468 KB
testcase_06 AC 177 ms
8,048 KB
testcase_07 AC 19 ms
8,048 KB
testcase_08 AC 187 ms
8,152 KB
testcase_09 AC 1,417 ms
8,428 KB
testcase_10 AC 16 ms
8,096 KB
testcase_11 AC 1,595 ms
8,532 KB
testcase_12 AC 3,852 ms
8,408 KB
testcase_13 AC 30 ms
8,480 KB
testcase_14 AC 1,407 ms
8,472 KB
testcase_15 AC 1,447 ms
8,408 KB
testcase_16 AC 40 ms
8,028 KB
testcase_17 AC 1,042 ms
8,424 KB
testcase_18 AC 835 ms
8,528 KB
testcase_19 AC 35 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)

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

    ct_max_min = min(ct_max_min, ct_max)

print(ct_max_min)
0