結果

問題 No.9 モンスターのレベル上げ
ユーザー kou
提出日時 2019-12-16 22:37:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,686 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 628 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-02 20:40:49
合計ジャッジ時間 16,929 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from heapq import *
from collections import deque

def main():
	n = int(input())
	ans = 1 << 30
	p = [l * 1510 for l in map(int, input().split())]
	heapify(p)
	enemies = deque(map(int, input().split()))
	for _ in range(n):
		party = p[:]
		for el in enemies:
			x = heappop(party)
			heappush(party, (x // 1510 + el // 2) * 1510 + x % 1510 + 1)
		ans = min(ans, max(x % 1510 for x in party))
		enemies.rotate(1)
	print(ans)

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