結果

問題 No.9 モンスターのレベル上げ
ユーザー nisizawanisizawa
提出日時 2017-12-19 11:51:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,339 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 89,832 KB
最終ジャッジ日時 2023-09-06 05:38:05
合計ジャッジ時間 15,017 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,120 KB
testcase_01 AC 80 ms
71,160 KB
testcase_02 AC 1,339 ms
89,832 KB
testcase_03 AC 1,109 ms
86,176 KB
testcase_04 AC 666 ms
81,416 KB
testcase_05 AC 487 ms
79,476 KB
testcase_06 AC 284 ms
79,044 KB
testcase_07 AC 127 ms
77,780 KB
testcase_08 AC 312 ms
78,560 KB
testcase_09 AC 1,330 ms
89,300 KB
testcase_10 AC 82 ms
71,116 KB
testcase_11 AC 1,068 ms
87,572 KB
testcase_12 AC 1,138 ms
86,768 KB
testcase_13 AC 917 ms
87,140 KB
testcase_14 AC 1,299 ms
89,192 KB
testcase_15 AC 1,213 ms
88,064 KB
testcase_16 AC 152 ms
77,916 KB
testcase_17 AC 831 ms
83,444 KB
testcase_18 AC 733 ms
82,320 KB
testcase_19 AC 143 ms
77,724 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()]

ct_max_min = float('inf')
for i in range(n):
    hq = [(a, 0) for a in a_ls]
    heapq.heapify(hq)
    
    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)

    ct_max_min = min(ct_max_min, ct_max)

print(ct_max_min)
0