Woburn Challenge 2017-18 Finals Round - Senior Division
The Party of Extraterrestrial Gangsters are not at all pleased with how their invasion of Earth is going so far. Their soldiers on the ground are losing in combat to the well-prepared battalions of cows and monkeys, and their nuclear bomb has been defused with particular ease. Fortunately for them, PEG's space battleship is also outfitted with an enormously powerful vaporizer beam capable of wiping out Scarberia in an instant. The PEG leaders were hoping to avoid resorting to such a merciless tactic, but they're running out of alternatives. However, before proceeding with any vaporization, they'll issue an ultimatum to the Scarberian leaders, detailing the amount of potential destruction and providing an opportunity for unconditional surrender instead.
Downtown Scarberia has a row of
The PEG leaders have come up with a list of
- The beam will lock onto the tallest remaining un-vaporized
skyscraper, and vaporize it. If there are multiple such skyscrapers
with equal heights, they'll choose one of them uniformly at random.
They'll repeat this process
times, meaning that exactly skyscrapers will get vaporized in this phase. - The beam will vaporize all of the un-vaporized skyscrapers numbered
between
and , inclusive. Note that some of these skyscrapers may have already been vaporized in phase 1 of the attack, meaning that anywhere between and skyscrapers (inclusive) will get vaporized in this phase.
For each possible plan of attack, the PEG leaders are interested in the
expected number of citizens who would get vaporized in it (that is, the
expected total number of citizens occupying all of the vaporized
skyscrapers). Disclosing these statistics in an ultimatum would be sure
to drive the Scarberian forces to immediately surrender! Help them
determine this value for each of the
Subtasks
In test cases worth
In test cases worth another
Input Specification
The first line of input consists of a single integer,
The next line consists of a single integer,
Output Specification
Output
Your answer must have at most
Sample Input
5
4 1
2 50
6 400
4 100
3 33
3
5 1 5
4 2 2
2 2 4
Sample Output
584.0
584.0
550.5
Sample Explanation
In the first plan of attack, all
In the second plan of attack, the
In the third plan of attack, phase
Comments