Minimum Cost to Connect Two Groups of Points SOLUTION

Minimum Cost to Connect Two Groups of Points

You are given two gatherings of focuses where the primary gathering has size1 focuses, the subsequent gathering has size2 focuses, and size1 >= size2. 
 
The expense of the association between any two focuses are given in a size1 x size2 lattice where cost[i][j] is the expense of interfacing point I of the main gathering and point j of the subsequent gathering. The gatherings are associated if each point in the two gatherings is associated with at least one focuses in the contrary gathering. As such, each point in the main gathering must be associated with at any rate one point in the subsequent gathering, and each point in the subsequent gathering must be associated with in any event one point in the principal gathering. 
 
Return the base cost it takes to interface the two gatherings. 
 
Model 1: 
 
Information: cost = [[15, 96], [36, 2]] 
 
Yield: 17 
 
Clarification: The ideal method of interfacing the gatherings is: 
 
1- – A 
 
2- – B 
 
This outcomes in a complete expense of 17. 
 
Model 2: 
 
Info: cost = [[1, 3, 5], [4, 1, 1], [1, 5, 3]] 
 
Yield: 4 
 
Clarification: The ideal method of associating the gatherings is: 
 
1- – A 
 
2- – B 
 
2- – C 
 
3- – A 
 
This outcomes in an absolute expense of 4. 
 
Note that there are numerous focuses associated with point 2 in the primary gathering and point An in the subsequent gathering. This doesn’t make a difference as there is no restriction to the quantity of focuses that can be associated. We just consideration about the base absolute expense. 
 
Model 3: 
 
Info: cost = [[2, 5, 1], [3, 4, 7], [8, 1, 2], [6, 2, 4], [3, 8, 8]] 
 
Yield: 10 
 
Limitations: 
 
size1 == cost.length 
 
size2 == cost[i].length 
 
1 <= size1, size2 <= 12 
 
size1 >= size2 
 
0 <= cost[i][j] <= 100
 

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

RELATED :

Related :

Related :

Leave a Comment

close
error: Content is protected !!