Note: This is an approximate problem. There is no exact solution. You must find the most optimal solution. Please, take a look at the sample explanation to ensure that you understand the problem correctly.
The HackerEarth land consists of N cities and M roads connecting them. Every city has at-least one road connected to it. There can be more than one road connecting pair of cities and there can be a road which connects the city with itself. There can be no way to connect from one city to some other city using only these roads.
The mayor has decided to order the reconstruction of the roads in the city, every road has a specific cost to be reconstructed and please note for every city there must exist at-least one road connected to it which is reconstructed.
You are given an array A of length N where A[i] denotes the cost to bear if a road connected to ith city is reconstructed. Means if there is a road connection city i, j then the cost to bear for that road will be A[i]+A[j].
The total cost of reconstruction will be evaluated as follows:
Aim is to minimize Z = total cost of reconstruction.
Input format
Output format
Verdict and scoring
Constraints
1≤N,M≤1051≤A[i],w≤105
Cost of roads reconstruction
Cost to bear due to cities
Z=67+28=95