結果

問題 No.9 モンスターのレベル上げ
ユーザー 双六双六
提出日時 2020-07-26 00:15:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,022 ms / 5,000 ms
コード長 784 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 81,284 KB
最終ジャッジ日時 2023-09-10 02:20:25
合計ジャッジ時間 12,439 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
72,564 KB
testcase_01 AC 110 ms
72,504 KB
testcase_02 AC 1,022 ms
81,284 KB
testcase_03 AC 830 ms
80,776 KB
testcase_04 AC 529 ms
79,820 KB
testcase_05 AC 397 ms
79,204 KB
testcase_06 AC 260 ms
79,076 KB
testcase_07 AC 155 ms
78,684 KB
testcase_08 AC 278 ms
79,392 KB
testcase_09 AC 988 ms
80,560 KB
testcase_10 AC 112 ms
72,856 KB
testcase_11 AC 794 ms
80,168 KB
testcase_12 AC 896 ms
80,752 KB
testcase_13 AC 709 ms
80,416 KB
testcase_14 AC 999 ms
80,580 KB
testcase_15 AC 894 ms
80,748 KB
testcase_16 AC 173 ms
79,032 KB
testcase_17 AC 647 ms
80,424 KB
testcase_18 AC 567 ms
79,544 KB
testcase_19 AC 168 ms
78,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
from heapq import heappop, heappush
import copy

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = list(sorted(getlist()))
	B = getlist()
	# [レベル*10000+戦闘回数]
	Q = []
	for i in range(N):
		heappush(Q, A[i] * 10000)

	ans = INF
	for i in range(N):
		start = i
		Q2 = copy.copy(Q)
		for j in range(N):
			lvcnt = heappop(Q2)
			lvcnt += int((B[(start + j) % N]) // 2) * 10000 + 1
			heappush(Q2, lvcnt)

		# print(Q2)
		val = 0
		for j in range(N):
			val = max(val, Q2[j] % 10000)
		# print(val)

		ans = min(ans, val)

	print(ans)


if __name__ == '__main__':
	main()
0