結果

問題 No.9 モンスターのレベル上げ
ユーザー gigurururugigurururu
提出日時 2014-12-30 19:42:47
言語 Python2
(2.7.18)
結果
AC  
実行時間 4,740 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 6,788 KB
実行使用メモリ 6,648 KB
最終ジャッジ日時 2023-09-06 03:20:34
合計ジャッジ時間 35,370 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,368 KB
testcase_01 AC 13 ms
6,412 KB
testcase_02 AC 3,472 ms
6,624 KB
testcase_03 AC 2,714 ms
6,432 KB
testcase_04 AC 1,438 ms
6,468 KB
testcase_05 AC 964 ms
6,448 KB
testcase_06 AC 337 ms
6,404 KB
testcase_07 AC 19 ms
6,244 KB
testcase_08 AC 451 ms
6,460 KB
testcase_09 AC 3,371 ms
6,484 KB
testcase_10 AC 13 ms
6,308 KB
testcase_11 AC 3,203 ms
6,528 KB
testcase_12 AC 4,740 ms
6,520 KB
testcase_13 AC 3,250 ms
6,512 KB
testcase_14 AC 3,368 ms
6,632 KB
testcase_15 AC 3,074 ms
6,648 KB
testcase_16 AC 63 ms
6,344 KB
testcase_17 AC 1,980 ms
6,496 KB
testcase_18 AC 1,662 ms
6,476 KB
testcase_19 AC 42 ms
6,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n=input()
a=map(int,raw_input().split())+[1e9]
heapq.heapify(a)
a=[(i,0) for i in a]
b=[int(i)/2 for i in raw_input().split()]

def check(i):
    pq=a[:]
    for elevel in b[i:]+b[:i]:
        level,cnt=heapq.heappop(pq)
        heapq.heappush(pq,(level+elevel,cnt+1))
    return max(y for x,y in pq)

print(min(check(i) for i in range(n)))
0