結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,008 KB
testcase_01 AC 17 ms
8,056 KB
testcase_02 AC 2,042 ms
8,536 KB
testcase_03 AC 1,607 ms
8,532 KB
testcase_04 AC 876 ms
8,628 KB
testcase_05 AC 581 ms
8,416 KB
testcase_06 AC 206 ms
8,012 KB
testcase_07 AC 19 ms
8,040 KB
testcase_08 AC 279 ms
7,968 KB
testcase_09 AC 1,965 ms
8,568 KB
testcase_10 AC 15 ms
8,004 KB
testcase_11 AC 1,846 ms
8,596 KB
testcase_12 AC 2,564 ms
8,456 KB
testcase_13 AC 1,812 ms
8,492 KB
testcase_14 AC 1,999 ms
8,472 KB
testcase_15 AC 1,822 ms
8,500 KB
testcase_16 AC 48 ms
8,048 KB
testcase_17 AC 1,194 ms
8,344 KB
testcase_18 AC 988 ms
8,616 KB
testcase_19 AC 34 ms
7,972 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)

hb_ls = [b // 2 for b in b_ls]
hdb_ls = hb_ls + hb_ls

ans = n
for i in range(n):
    hq = hq_o[:]
    
    for hb in hdb_ls[i:i + n]:
        lv, ct = hq[0]
        heapq.heapreplace(hq, (lv + hb, ct + 1))
    
    ans = min(ans, max([ct for lv, ct in hq]))

print(ans)
0