Problem D
Delivering Goods

The road network consists of one-way streets between junctions. The warehouse and clients are all located at a junction. You know the driving time across each street.
You guarantee extremely fast shipping: the trucks start
driving immediately at the start of the day and each client
What is the minimum number of trucks you have to deploy to
ensure this guarantee is met? That is, what is the minimum
number of trucks such that it is possible to give each truck a
driving route so that every client
Input
The input consists of a single test case. The first line of
each test case consists of three numbers
The junctions are numbered
The rest of the input consists of
There will be at most one street from a vertex
Output
Output a single integer that is the minimum number of
vehicles required to ensure each client
Explanations of Sample Inputs
In the first sample, one vehicle can follow the path
Sample Input 1 | Sample Output 1 |
---|---|
4 5 3 1 2 3 0 1 1 0 3 1 0 2 2 1 2 1 3 2 1 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
4 5 3 1 2 3 0 1 1 0 3 1 0 2 1 1 2 1 3 2 1 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
8 11 5 1 3 4 6 7 0 1 5 0 4 1 0 2 2 0 6 6 2 3 1 2 6 3 3 5 7 4 1 5 5 7 3 6 5 6 4 6 4 |
3 |