結果

問題 No.9 モンスターのレベル上げ
ユーザー TawaraTawara
提出日時 2016-07-27 00:27:02
言語 Python2
(2.7.18)
結果
AC  
実行時間 4,915 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 6,664 KB
実行使用メモリ 6,384 KB
最終ジャッジ日時 2023-09-06 04:56:33
合計ジャッジ時間 38,982 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,224 KB
testcase_01 AC 12 ms
6,108 KB
testcase_02 AC 3,852 ms
6,260 KB
testcase_03 AC 3,011 ms
6,192 KB
testcase_04 AC 1,628 ms
6,228 KB
testcase_05 AC 1,069 ms
6,348 KB
testcase_06 AC 380 ms
6,192 KB
testcase_07 AC 19 ms
6,052 KB
testcase_08 AC 503 ms
6,256 KB
testcase_09 AC 3,737 ms
6,264 KB
testcase_10 AC 12 ms
6,108 KB
testcase_11 AC 3,562 ms
6,280 KB
testcase_12 AC 4,915 ms
6,300 KB
testcase_13 AC 3,545 ms
6,224 KB
testcase_14 AC 3,785 ms
6,272 KB
testcase_15 AC 3,437 ms
6,340 KB
testcase_16 AC 71 ms
6,128 KB
testcase_17 AC 2,212 ms
6,292 KB
testcase_18 AC 1,859 ms
6,384 KB
testcase_19 AC 46 ms
6,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq as hpq
def solve():
	Q = []
	N = int(raw_input())
	ans = N+1
	Q = [(a,0) for a in map(int,raw_input().split())]
	hpq.heapify(Q)
	B = map(int,raw_input().split())
	for i in xrange(N):
		q = Q[:]
		for j in xrange(N):
			lv,cnt = hpq.heappop(q)
			hpq.heappush(q,(lv+B[(i+j)%N]/2,cnt+1))
		ans = min(ans,max(q,key=lambda x:x[1])[1])
	print ans
solve()
0