Company: Infoedge_5april
Difficulty: medium
Smart Shopkeeper Problem Description A smart shopkeeper bought n items with the cost price of i-th item as a[i] (0 <= i < n). Now he wants to sell these n items, such that he gets the maximum profit. But there are some constraints that the shopkeeper can only sell k items, with a profit less than or equal to 20%, and the remaining items (n-k) he can sell with a profit less than or equal to 10%. /* * Complete the 'solve' function below. * * The function is expected to return a LONG INTEGER. * The function accepts following parameters: * 1. INTEGER ARRAY a * 2. INTEGER K */ long solve(vector<int> a, int k) { // Write your code here } Input Format First line of input is n , the total number of items. Next line is the cost price of each item a[i] . (0 <= i < n) Next line will be the integer k , denoting the number of items he can sell with a profit up to 20%. Output Format Output the maximum profit a shopkeeper can get. Constraints (1 <= n <= 10^5) (1 <= a[i] <