0
点赞
收藏
分享

微信扫一扫

Lorry翻译(day 2)

独西楼Q 2022-01-20 阅读 62
c++

Lorry

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.

Input

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.

Output

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.

Examples

input

output

7
2

翻译:一群游客打算前往皮划艇与双体船之旅,一辆租来的货车已经到达了船港,将皮划艇以及双体船带到指定的出发点。已知所有的皮划艇都是相同的大小。(并且每一个都占据一立方米的大小)所有的双体船也是相同的大小,但是2倍大于皮划艇(并且占据的面积为2立方米)。

每一个水运装置都有一个特定的载货量。应该注意的是看起来相同的装置可以有不同的载货量。了解这个卡车车身体积以及在船港中的水运装置的清单(每一个大小以及载货量都已知)。找出卡车可以承载的船并且有最大的载货量。这个卡车的车身体积应该得到最有效的利用。也就是说你可以将船的体积不超过卡车剩余体积的船放入其中。

输入:

第一行包括一对整数n与v(1 ≤ n ≤ 105; 1 ≤ v ≤ 109),n代表着在船港中的船的数量,v是卡车车身占据的体积大小(一立方米为单位)。接下来的n行包括船的信息,有一对整数 ti, pi (1 ≤ ti ≤ 2; 1 ≤ pi ≤ 104),ti代表着船的类型, (1 – 皮划艇, 2 – 双体船),并且pi是船的载货量。船按照在输入文件中的顺序进行枚举。

输出:
在第一行打印最大可能的载货量。在第二行包含一个船编号最优集的船编号。如果答案不是唯一的,打印其中任意一个。

举例:

输入:

output

7
2
departure
英 [dɪˈpɑːtʃə(r)]美 [dɪˈpɑːrtʃər]
n.

离开; 出发; 背离; 起程; (在特定时间)离开的飞机(或火车等); 违反; 逾越;

waterborne
英 [ˈwɔːtəbɔːn]美 [ˈwɔːtərbɔːrn]
adj.水传播的; 水源传染的; 经水路的; 水运的;

enumerated
英 [ɪˈnjuːməreɪtɪd]美 [ɪˈnuːməreɪtɪd]
v.列举; 枚举;

optimal英 [ˈɒptɪməl]美 [ˈɑːptɪməl]
adj.最优的; 最佳的;

总结:今天翻了一篇还比较长的,自我感觉还可以,比昨天的翻译的应该更好。加油!继续努力!

但还有一些单词不认识,继续背单词吧。

举报

相关推荐

英文题目翻译day2

翻译(2)

英文题目翻译day5

英文题目翻译day8

Day 2

day 2

0 条评论