this is a question from july long challenge.
Question Link - https://www.codechef.com/JULY20B/problems/DRCHEF
my solution link - https://www.codechef.com/viewsolution/35869168
i think there is some issue with while loop but i cannot find it, because of which i cannot even clear the sample testcases. Kindly Help !
A short gist of my logic -
Note 1 : IF a country gets cured then i remove that country’s population from multiset.
Note 2 : if the multiset is empty, just print out the days.
if X is greater than or equal to most populated country then answer is number of countries present in my multiset.
else two conditions arise -
if there is a value in multiset (each set element representing a country’s population) which falls in the range [x,2x] inclusive then, we know that answer is days = days + current set.size (as from this day we will need only as many days as many countries are left to be cured)
Else if no element of the set falls within the range [x,2x] then we will use two times of, cures used on previous day, to cure the country with the largest population currently present in multiset. and also update the x for next day
i.e x = 2*x