Problem A
Branch Assignment
The Innovative Consumer Products Company (ICPC) is planning
to start a top-secret project. This project consists of
At the end of each month, each branch will send a message to
every other branch in its group (a different message to each
branch). ICPC has a particular protocol for its communications.
Each branch
Given a road network and the locations of branches and the headquarters in this network, your task is to determine the minimum total distance that the couriers will need to travel to deliver all the end-of-month messages, over all possible assignments of branches to subprojects.
Input
The first line of input contains four integers
Output
Display the minimum total distance that the couriers will need to travel.
Sample Input 1 | Sample Output 1 |
---|---|
5 4 2 10 5 2 1 2 5 1 3 5 5 4 5 0 1 5 1 2 3 1 3 2 5 2 4 5 2 1 1 3 4 2 |
13 |
Sample Input 2 | Sample Output 2 |
---|---|
5 4 2 10 5 2 1 2 5 1 3 5 5 4 5 10 1 5 1 2 3 1 3 2 5 2 4 5 2 1 1 3 4 2 |
24 |