NPS-INR-Cyber-Programming-2021

The 2021 edition of the NPS Indiranagar interhouse Cyber Programming contest.

View on GitHub

Bill’s Cookie Addiction

Problem Statement:

Breaking News. A sting operation has revealed ever since his divorce, ex-richest-man-on-earth, Bill Gates, has developed a strong addiction for girl scout cookies. If Bill has eaten j cupcakes so far, after eating a scout cookie with c calories he must walk at least $2^j * c$ miles to maintain his weight. But Bill is a very lazy person and chooses to eat the cookies in an order such that he has to walk the least number of miles. Help Bill find the least number of miles he must walk to maintain his weight.

Constraints:

Subtask 1:

Subtask 2:

Input Format:

Output Format:

Sample input:

3 1 3 2 

Sample output:

11