結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー 6soukiti29
提出日時 2017-03-26 05:53:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-06 04:27:15
合計ジャッジ時間 1,862 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

Gx,Gy,N,F = map(int,input().split())
L = []
P = [[0,0,0]]
for n in range(N):
	x,y,c = list(map(int,input().split()))
	if c / (x + y) > F:
		pass
	else:
		pi = len(P)
		for i,p in enumerate(P):
			if x + p[0] <= Gx and y + p[1] <= Gy and i < pi:
				x2 = p[0] + x
				y2 = p[1] + y
				c2 = p[2] + c
				if [x2, y2, c2] not in P:
					P.append([x2,y2,c2])
m = float("inf")
for p in P:
	x = Gx - p[0]
	y = Gy - p[1]
	c = (x + y) * F + p[2]
	if c < m:
		m = c
print(m)
0