原题链接--
Lorry
2000ms 65536K
描述:
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times bigger than kayaks (and occupy the space of 2 cubic metres).
Each waterborne vehicle has a particular carrying capacity, and it should be noted that waterborne vehicles that look the same can have different carrying capacities. Knowing the truck body volume and the list of waterborne vehicles in the boat depot (for each one its type and carrying capacity are known), find out such set of vehicles that can be taken in the lorry, and that has the maximum total carrying capacity. The truck body volume of the lorry can be used effectively, that is to say you can always put into the lorry a waterborne vehicle that occupies the space not exceeding the free space left in the truck body.
译文:一组游客打算进行皮艇和双体船之旅。一辆被租用的卡车到达了船舱并将皮艇和双体船放置在了出发点 。所有的皮梃都有相同的大小(每一个都占用一方立方米的空间),所有的双体船也都大小相同,但是他们有皮艇的两倍大 (占用两2立方米的空间 )。
每一个水上交通工具都有特别的携带容量,需要注意的是看起来相同的水上交通工具可能有不同的携带容量。知道卡车车身体积和船舱里面的水上交通工具的清单(每一个的类型和携带容量都已知),找出卡车能携带的一组水上交通工具,并且有着最大携带容量 。卡车车身体积能被有效的使用,也就是说你能放进卡车的水上交通工具其所占用的空间不超过卡车车身留下的自由使用空间 。
输入:
The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi (1 ≤ ti ≤ 2; 1 ≤ pi ≤ 104), where ti is the vehicle type (1 – a kayak, 2 – a catamaran), and pi is its carrying capacity. The waterborne vehicles are enumerated in order of their appearance in the input file.
译文:第一行包含整数n和v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109),n是在船舱里的水上交通工具的数量,v是以立方米计算的卡车车身体积。接下来n行包含水上交通工具的信息,有一对数 ti, pi (1 ≤ ti ≤ 2; 1 ≤ pi ≤ 104),ti是卡车类型(1--皮艇,2--双体船,pi是它的携带体积。在输出文件中水上交通工具被按顺序枚举它们的外观。
输出:
In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them.
译文:第一行打印出这一组交通工具的最大携带体积。第二行打印出由字符串组成的有最佳解的交通工具的数字。如果答案不唯一,打印出其中一组解。
样例输入:
3 2 1 2 2 7 1 3
样例输出:
7 2