QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#13830. Bubble Tang

الإحصائيات

During the XXXXth NOI, to strengthen the exchange between contestants from different provinces, the organizing committee decided to hold an inter-provincial e-sports tournament. Each provincial team consists of $n$ players, and the game played is the popular online game "Bubble Hall." Before each match, the coaches of both sides submit a list of participating players to the organizing committee to determine the order in which the players will compete. Once determined, this order cannot be changed. During the match, the first player, second player, ..., and $n$-th player of both sides compete in pairs, for a total of $n$ individual games. A win earns 2 points, a draw earns 1 point, and a loss earns 0 points. The total score is calculated by summing the points from all individual games, and the team with the higher total score advances (if the total scores are tied, the winner is decided by a draw).

As the team leader of the Zhejiang team, you have already clearly understood the "Bubble Hall" skill level of all players from every province and have quantified it with a strength value. To simplify the problem, we assume that players are completely unaffected by any external factors in the game; that is, a player with higher strength will always defeat a player with lower strength, and two players with the same strength will always draw. Since you have no idea what strategy the opponent will use to determine their lineup, all teams have adopted a strategy of determining the lineup completely at random.

Of course, you do not want to compete in such an uncertain manner. You want to know in advance the maximum and minimum possible total scores the Zhejiang team can achieve.

Input

The first line of the input contains an integer $n$, representing the number of players in each team.

The next $n$ lines each contain an integer, describing the strength values of the $n$ players of the Zhejiang team.

The next $n$ lines each contain an integer, describing the strength values of the $n$ players of your opponent.

Constraints: $20\%$ of the data: $1 \le n \le 10$ $40\%$ of the data: $1 \le n \le 100$ $60\%$ of the data: $1 \le n \le 1000$ $100\%$ of the data: $1 \le n \le 100000$, and all players' strength values are between $0$ and $10000000$.

Output

The output should contain two space-separated integers, representing the maximum and minimum total scores the Zhejiang team can achieve, respectively. Do not output extra whitespace at the end of the line.

Examples

Input 1

2
1
3
2
4

Output 1

2 0

Note 1

Let us call the 4 players A, B, C, and D. There are 4 possible matchups, where the best case yields 2 points and the worst case yields 0 points.

I II III IV
Zhejiang Opponent Result Zhejiang Opponent Result Zhejiang Opponent Result Zhejiang Opponent Result
Player 1 A C Loss A D Loss B C Win B D Loss
Player 2 B D Loss B C Win A D Loss A C Loss
Total Score 0 2 2 0

Input 2

6
10000000
10000000
10000000
10000000
10000000
10000000
0
0
0
0
0
0

Output 2

12 12

Note 2

The opponents are good children who study hard and do not play games. No matter how the lineup is arranged, the result of being crushed cannot be changed. The Zhejiang team can always achieve a total victory.

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.