/frustrated.c

3. Frustrated coders There are N frustrated coders standing in a circle with a gun in their hands. Each coder has a skill value S[ i ] and he can only kill those coders that have strictly less skill than him. One more thing, all the guns have only 1 bullet. This roulette can take place in any random order. Fortunately, you have the time stone (haaan wo harre wala) and you can see all possible outcomes of this scenario. Find the outcome where the total sum of the remaining coder's skill is minimum. Print this sum. Input Format The first line contains N the no. of coders The next line contains N elements where the ith element is theS[ i ] of ith coder. Output Format Print a single line containing the minimum sum. Constraints 1<= N <= 1000000 1<=S[ i ]<=1000

frustrated.c

  1. Frustrated coders There are N frustrated coders standing in a circle with a gun in their hands. Each coder has a skill value S[ i ] and he can only kill those coders that have strictly less skill than him. One more thing, all the guns have only 1 bullet. This roulette can take place in any random order. Fortunately, you have the time stone (haaan wo harre wala) and you can see all possible outcomes of this scenario. Find the outcome where the total sum of the remaining coder's skill is minimum. Print this sum. Input Format The first line contains N the no. of coders The next line contains N elements where the ith element is theS[ i ] of ith coder. Output Format Print a single line containing the minimum sum. Constraints 1<= N <= 1000000 1<=S[ i ]<=1000