結果

問題 No.9 モンスターのレベル上げ
ユーザー ゆるくゆるく
提出日時 2015-05-16 04:03:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,743 ms / 5,000 ms
コード長 623 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 8,896 KB
最終ジャッジ日時 2023-09-06 03:49:34
合計ジャッジ時間 15,263 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,560 KB
testcase_01 AC 19 ms
8,692 KB
testcase_02 AC 1,431 ms
8,724 KB
testcase_03 AC 1,105 ms
8,696 KB
testcase_04 AC 641 ms
8,808 KB
testcase_05 AC 451 ms
8,800 KB
testcase_06 AC 119 ms
8,564 KB
testcase_07 AC 21 ms
8,564 KB
testcase_08 AC 169 ms
8,796 KB
testcase_09 AC 1,264 ms
8,800 KB
testcase_10 AC 19 ms
8,552 KB
testcase_11 AC 1,446 ms
8,844 KB
testcase_12 AC 2,743 ms
8,872 KB
testcase_13 AC 69 ms
8,756 KB
testcase_14 AC 1,285 ms
8,784 KB
testcase_15 AC 1,321 ms
8,808 KB
testcase_16 AC 34 ms
8,540 KB
testcase_17 AC 902 ms
8,896 KB
testcase_18 AC 734 ms
8,652 KB
testcase_19 AC 37 ms
8,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
from collections import deque
d = deque()
n = int(input())

a = []

for i in (input().split()):
    heapq.heappush(a,((int(i) << 24) + 0))
b = deque(list(map(int, input().split())))
c = n
ans = 0xFFFFFFFF

mxlist = [0] * n
while (c):
    tmp = list(a)
    mx = 0
    index = 0
    for bb in b:
        t = heapq.heappop(tmp)
        am = t & 0xFFFFFF
        bm = t >> 24
        bm += bb >> 1
        am += 1
        mxlist[index] = am
        if am >= ans:
            break
        index += 1
        heapq.heappush(tmp, (bm << 24) + am)
    c -= 1
    ans = min(ans, max(mxlist))
    b.rotate(1)
print(ans)
0