結果

問題 No.2366 登校
ユーザー shobonvip
提出日時 2023-06-30 14:05:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,020 KB
実行使用メモリ 71,680 KB
最終ジャッジ日時 2024-07-07 21:54:00
合計ジャッジ時間 2,182 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k,t = map(int,input().split())
targ = n+m-2-t

if targ <= 0:
	print(0)
	exit()

ans = 10 ** 18

for i in range(k):
	a, b, c, d = map(int,input().split())
	c -= 1
	if c == 0: continue
	ans = min(ans, ((targ+c-1)//c) * d)

if ans == 10 ** 18:
	print(-1)
else:
	print(ans)
0