Problem # 27 : Coach

A coach wants to select the best team from a few individuals. Each person is given some points. A few pairs of individuals are given some interaction points. Write a subroutine to select the best team by maximising the points of the team. The team points is the sum of individual points and interaction points of all the pairs in the team.

Write a sub-routine COACH(M N A()) which returns the combination if players forming the best team.
M is the number of persons to be selected for the team
N is the number of players to choose from
A() is an array of size NxN containing data about the players.

In case the best team can be formed by more than one combination of players output any one combination.

A(X X) contains individual points for player X
A(X Y) = A(Y X) contains the interaction points between players X and Y
For example A(1 1) contains the individual points of player 1 while A(1 2) and A(2 1) contain the interaction points between player 1 and 2

Sample Output
If the array is as follows :-
[Sample Input]
coach(3 5 A()) should produce the following output on the screen :
 
The best combination of players would be :
Player 1
Player 2
Player 5


Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem

LinkExchange
LinkExchange Member
1