#1252. SGU278 Fuel

SGU278 Fuel

题目描述

A fuel station has infinite amount of each of NN kinds of fuel. Each kind of fuel has density aia_{i}, cost bib_{i} and intensity cic_{i}.mm kilograms of such fuel has volume maima_{i}, intensity mcimc_{i} and costs mbimb_{i} dollars. Your car can store any mixture of different kinds of fuel such that the overall volume does not exceed AA. You have BB dollars. Your task is to determine the maximal overall intensity of the fuel you can buy. Note that you can buy any nonnegative amount of any kind of fuel, not necessarily an integer number of kilograms.

输入格式

The first line of the input contains three integers N,A,BN,A,B (1N100000,1A,B1000)(1 \leq N \leq 100000,1 \leq A,B \leq 1000).Each of the next NN lines describes one kind of fuel. i+1sti+1-st line contains three integers ai,bi,ci (ai,bi,ci1000)a_{i},b_{i},c_{i} \ (a_i,b_i,c_i \leq 1000).

2 3 3
1 2 1
2 1 1
2.000

数据范围

对于所有的数据:

0A,B1050 \leq A,B \leq 10^5

0<ai,bi,ci10000<a_i,b_i,c_i \leq 1000

对于 50%50\% 的数据:

N100N \leq 100

对于 100%100\% 的数据:

N105N \leq 10^5