結果

問題 No.9 モンスターのレベル上げ
ユーザー ゆるく
提出日時 2015-05-16 04:03:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,158 ms / 5,000 ms
コード長 623 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-23 22:39:32
合計ジャッジ時間 16,716 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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