luogu#P4937. Portal1
Portal1
Background
There are many ways for an Agent to obtain resources, and HACK is one of them. By breaking into a Portal, you can get many useful resources.
Because the ENLIGHTENED headquarters joined the XM war, there are only a small amount of usable resources left. Therefore, the ENLIGHTENED operation commander wants to carry out HACK activities to increase the inventory as much as possible.
Problem Description
There are Portals on the map that can be HACKed, numbered from to . HACKing Portal takes seconds and can produce resources to add to the inventory. However, only Portals with energy can produce resources when HACKed. For Portal , its energy will be completely depleted at time seconds. ENLIGHTENED wants to know the maximum amount the inventory can be increased, and also output the indices of the Portals that need to be HACKed in increasing order.
Input Format
The first line contains an integer .
The next lines each contain three integers , , .
Output Format
The first line outputs an integer: the maximum amount the inventory can be increased.
The second line outputs an integer: how many Portals need to be HACKed.
The third line outputs the indices of the Portals to be HACKed in increasing order. If there are multiple valid HACK plans, output any one of them.
3
5 6 5
1 8 2
2 7 3
7
2
1 2
Hint
For of the data, , , , .
For of the data, , , , .
For of the data, , , , .
For of the data, , , , 。
Translated by ChatGPT 5