結果

問題 No.9 モンスターのレベル上げ
ユーザー gigurururugigurururu
提出日時 2014-12-30 19:33:33
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,383 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 77,848 KB
実行使用メモリ 89,988 KB
最終ジャッジ日時 2023-09-06 03:17:34
合計ジャッジ時間 14,213 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
78,224 KB
testcase_01 AC 80 ms
77,904 KB
testcase_02 AC 1,383 ms
89,988 KB
testcase_03 AC 1,083 ms
86,412 KB
testcase_04 AC 595 ms
83,080 KB
testcase_05 AC 439 ms
83,248 KB
testcase_06 AC 265 ms
81,216 KB
testcase_07 AC 133 ms
80,204 KB
testcase_08 AC 307 ms
81,064 KB
testcase_09 AC 1,269 ms
88,132 KB
testcase_10 AC 78 ms
78,016 KB
testcase_11 AC 1,007 ms
87,784 KB
testcase_12 AC 1,120 ms
87,104 KB
testcase_13 AC 959 ms
87,896 KB
testcase_14 AC 1,105 ms
87,584 KB
testcase_15 AC 1,206 ms
88,216 KB
testcase_16 AC 158 ms
81,256 KB
testcase_17 AC 849 ms
84,888 KB
testcase_18 AC 646 ms
84,532 KB
testcase_19 AC 145 ms
80,720 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