QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#16579. The 80/20 Rule

Statistics

The law of twenty-eight (the Pareto law) is also known as the law of 80/20, and it is also called Barrett's law, Julen's law, the law of the critical minority, the law of the unimportant majority, the law of the least effort, the principle of imbalance. It is widely used in Sociology and business management. It was discovered by Pareto, an Italian economist in the late 19th and 20th centuries. He believes that in any set of things, the most important part only accounts for a small part of it, about $20 \%$ , and the remaining $80\%$, although in the majority, is secondary, so it is also known as the law of twenty-eight.

A popular example is that, the $80\%$ of the wealth in the world is owned by the $20\%$ of the people. Now I want you to write a program to check that, for a given set of bank accounts, whether the stored balances is strictly not weaker than the law of twenty-eight. The test method is to find two real numbers $A$, $B$, and the $A\%$ of the people own the $B\%$ of the wealth, and $B - A$ is maximized.

Input

The first line contains an integer $n$, indicating that we have the stored balances of $n$ accounts.

The second line contains $n$ integers $a_1, \dots, a_n$, which respectively represents the stored balance of each account.

Output

The first line contains two real numbers (the result is rounded to two decimal places), representing $A$, $B$ respectively.

If more than one pair of $(A, B)$ can maximize $B - A$, please output the answer with the largest $A$.

Example

Input 1

13
411 5622 3638 3411 5069 693 2738 3757 2496 2861 6761 355 1839

Output 1

46.15 71.27

Explanation 1

In the first set of examples, the stored balances of individuals $2, 3, 4, 5, 8, 11$ are $5622, 3638, 3411, 5069, 3757, 6761$, and their total balance is $28258$. The total balance of all people is $39651$. Therefore, these selected people, who have $28258/39651 \approx 71.27\%$ of the wealth, correspond to $6/13 \approx 46.15\%$ of all people.

Input 2

2
10 10

Output 2

100.00 100.00

Explanation 2

In the second set of examples, there are three possible sets of $(A, B)$, namely $(0, 0), (50, 50), (100, 100)$: their corresponding $B - A$ are all $0$. Therefore, according to the problem statement, you need to output the answer with the largest $A$, namely $(100, 100)$.

Subtasks

Subtask 1 (20pts): $1 \leq n \leq 20$

Subtask 2 (40pts): $1 \leq n \leq 1000$

Subtask 3 (40pts): $1\leq n\leq 10^5, 1 \leq a_i \leq 10^4$

For $100\%$ data, it's guaranteed that $1\leq n\leq 10^5, 1 \leq a_i \leq 10^4$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.