Tag Archives: priority-queue

Little Elephant and Lemonade : CodeChef Problem LELEMON

Problem link: http://www.codechef.com/AUG13/problems/LELEMON

Problem Statement:
Little Elephant likes lemonade.

When Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all.

There are n rooms (numbered from 0 to n-1), each contains C_i bottles. Each bottle has a volume (in litres). The first room visited by Little Elephant was P_0th, the second P_1th, …, the m-th P_{m-1}th room. Note that Little Elephant may visit a room more than once.

Find for Little Elephant the total volume of lemonade he has drunk.
Continue reading

Advertisements