結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー 6soukiti29
提出日時 2017-03-25 01:30:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 392 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 328,192 KB
最終ジャッジ日時 2024-07-06 03:25:21
合計ジャッジ時間 3,837 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

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()))
	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
			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