#P15051. [UOI 2023 II Stage] Nova Poshta
[UOI 2023 II Stage] Nova Poshta
题目描述
In the last minutes of the working day, a rush order for delivery of five oversized cargo items was received at the branch of Nova Poshta. There are only two trucks left in the branch: the first one has a load capacity of , and the second one has a load capacity of . The driver of the first truck is called Vasyl, and the driver of the second truck is called Petro.
Determine how to distribute the cargo between the trucks to fulfill the order.
输入格式
The first line contains five integers , , , , () --- the weights of the cargo items in tons.
The second line contains two integers and () --- the load capacities of Vasyl's and Petro's trucks, respectively.
输出格式
If the order cannot be fulfilled, print .
If both Vasyl and Petro can fulfill the order on their own, print .
If the order can be fulfilled by one truck only, but only one of the trucks has sufficient load capacity, print who should do it: or .
If the order can be fulfilled but both trucks are needed, print any possible distribution of cargo between the trucks in the following format:
- Print on the first line.
- On the second line, print the name , followed by a colon, space, and the numbers of the cargo items that need to be loaded onto the first truck.
- On the third line, print the name , followed by a colon, space, and the numbers of the cargo items that need to be loaded onto the second truck.
The numbers of the cargo items can be printed in any order.
10 10 10 10 10
20 20
They can not do it!
5 5 5 5 5
25 30
They both can do it!
5 5 5 5 5
30 20
Vasyl can do it!
5 5 5 5 5
10 25
Petro can do it!
7 8 9 10 11
30 30
They need to work together!
Vasyl: 1 2
Petro: 3 4 5
7 8 9 10 11
30 31
They need to work together!
Vasyl: 1 2
Petro: 5 3 4