409194: GYM103455 D Tug of War

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Tug of Wartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are attempting to build an optimal team for the upcoming game: Tug of War! To give yourself the best chance of winning, you decide to select the optimal team of size $$$\frac{n}{2}$$$ of a pool of $$$n$$$ contestants (for even $$$n$$$), where the optimal team is the team that gives the highest probability of winning against the opposite team made from the leftover contestants not on the chosen team. Furthermore, you want to estimate the probability that you actually win against the team made from the opposite team.

Each of the $$$n$$$ contestants have a strength rating, $$$s_i$$$, and the strength rating of a team is the sum of the strength ratings of all the members of the team. To calculate the probability of a team with strength rating $$$a$$$ of beating a team with strength rating $$$b$$$, you decide to use the standard ELO formula, which is given below.

$$$$$$ \frac{1}{1 + 10^{\frac{b - a}{400}}} $$$$$$

Given this information, output the strength rating of your optimal team and the probability this team beats the team of leftover contestants!

Input

The first line consists of a single even integer $$$n$$$ $$$(2 \leq n \leq 100)$$$, which gives the number of contestants. The next line consists of $$$n$$$ integers $$$s_i$$$ $$$(1 \leq s_i \leq 100)$$$, which gives the strength rating of each contestants.

Output

Output the strength rating of the optimal team and the probability that that optimal team beats the team made of the unpicked contestants.

ExampleInput
6
4 5 2 1 3 6
Output
15 0.5129491448928637

加入题单

算法标签: