#P1344. [USACO4.4] 追查坏牛奶 Pollutant Control
[USACO4.4] 追查坏牛奶 Pollutant Control
Description
On your first day at Sanlu Milk Company, something unlucky happens: the company accidentally shipped a batch of milk containing melamine.
Unfortunately, by the time you discovered this, the melamine-tainted milk had already entered the delivery network. The network is large and complex. You know which retailer this batch is destined for, but there are many different routes to deliver it.
The delivery network consists of warehouses and transport trucks. Each truck carries milk in one direction between a fixed pair of warehouses. To trace and block the tainted milk, you must ensure it is not delivered to the retailer, so some transport trucks must be stopped. However, stopping each truck incurs a certain monetary loss.
Your task is to decide which trucks to stop so that the tainted milk cannot reach the retailer, while minimizing the total loss.
Input Format
The first line contains two integers and . is the number of warehouses, and is the number of transport trucks. Warehouse is the factory (source), and warehouse is the retailer that the melamine-tainted milk is destined for.
Lines each contain three integers , , and . Here, and are the starting and ending warehouse of this truck, respectively. is the loss incurred by stopping this truck.
Output Format
Output two integers and . is the minimum total loss, and, among all solutions with minimum loss, is the minimum number of trucks that must be stopped.
4 5
1 3 100
3 2 50
2 4 60
1 2 40
2 3 80
60 1
Hint
Constraints: For of the testdata, , , , , .
Translation of the problem statement is from NOCOW.
USACO Training Section 4.4.
Translated by ChatGPT 5
京公网安备 11011102002149号