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.
In the Disneyland which consists of N cities and M connecting roads, you being the Mayor is planning to build new Hospitals to cure COVID - 19.
Every hospital which will be built in different cities, has two parameters associated with them.
So, C[i] and B[i], denotes the capacity and establisment cost of hospital which will be built in the ith city.
Due to spreading nature of virus we have following constraints on the establishment of hospitals.
You have to choose K cities to establish hospitals say represented by array A, such that the value of Z is maximized.
Z=∑Ki=1B[A[i]]−∑Ki=1C[A[i]]
Input
Output
Constraints
1≤N≤1041≤M≤2×1051≤u,v≤N1≤B[i],C[i]≤105C[i]≤B[i]
Verdict and scoring
Your score is equal to the sum of the values of all test files. The value of each test file is equal to the value of Z that you found.
Note, K integers must be less than or equal to N and distinct. If the output format if wrong or K citites selected does not follow condition in problem statement Wrong Answer verdict will be recieved.
Note : There are other possible answers also. Sample Input / Output is for explanation test cases follow input constraints.