ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

1.24 Lorry

2022-01-24 18:02:12  阅读:313  来源: 互联网

标签:capacity vehicles waterborne carrying ti pi Lorry 1.24


https://acs.jxnu.edu.cn/problem/CF3Bhttps://acs.jxnu.edu.cn/problem/CF3B

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

一组游客要去皮划艇和双体船旅游。一辆租来的货车已经到达船库,将皮划艇和双体船带到出发点。已知所有皮划艇都是同等大小(每个占据1立方米),而且所有的双体船都是同等大小,但是是皮划艇的两倍(每个占据2立方米)。

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.

每辆水上交通工具都有特定的承载能力,需要注意的是即使看起来相同的水上交通工具也有不同的承载能力。了解卡车车身的体积以及船库中的水上车辆体积(每个车辆的类型和承载能力是已知的),找出可以装在卡车上并且具有最大总承载能力的此类车辆。可以有效利用货车的车体容积,这意味着你可以将水上运输工具装进货车,可以占据货车空间而不溢出也没有空余的空间。

输入:

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.

第一行包括2个整数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

标签:capacity,vehicles,waterborne,carrying,ti,pi,Lorry,1.24
来源: https://blog.csdn.net/Zhouwen_/article/details/122671439

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有