Bzoj 1034: [zjoi2008]

Source: Internet
Author: User
1034: [zjoi2008] bnbtime limit: 10 sec memory limit: 162 MB
Submit: 1398 solved: 727
[Submit] [Status] Description

 

During Noi of xxxx, the organizing committee decided to organize an inter-provincial E-sports competition to enhance communication between contestants in each province. The team of each province was composed of N contestants, the Competition Project is an online game bubble hall suitable for old and young people. Prior to each competition, the coaches of both sides submitted a list of contestants to the organizing committee, which determined the playing sequence of the contestants. Once confirmed, they cannot be modified. During the competition, Contestant No. 1 and Contestant No. 2 ......, On the n th, the contestants fought and fought for a total of N games. Each winning game scored 2 points, one point for the same game, and no score for the same game. Finally, the two sides will sum up the single-field score to get the total score. The team with the highest total score will be promoted (the same total score will be determined by the lottery ). As the leader of the Zhejiang team, you have already clearly understood the bubble Hall Level of all contestants in each province in advance and measured it with one strength value. To simplify the problem, we assume that players in the game are completely immune from any external interference, that is, players with strong strengths will certainly be able to defeat those with weak strengths, and two players with the same strengths will surely be in the same position. Since we have no idea what strategy the opponent will use to determine the order of appearance, all teams adopt this strategy, that is, they randomly decide the order of appearance. Of course, you don't want to compete like this. You want to know in advance how many points the Zhejiang team will receive in the best and worst cases.

Input

The first input behavior is an integer N, indicating the number of people in each team. In the next n rows, each line contains an integer that describes the strength of the N Zhejiang contestants. In the next n rows, each line contains an integer that describes the strength of your opponent's n-digit contestant. In 20% of the data, 1 <= n <= 10; in 40% of the data, 1 <= n <= 100; in 60% of the data, 1 <= n <= 1000; in 100% of the data, 1 <= n <= 100000, and the strength of all contestants ranges from 0 to 10000000.

Output

Contains two integers separated by spaces, indicating how many points Zhejiang team can score in the best and worst cases respectively. Do not output extra white space characters at the end of the line.

Sample input2
1
3
2
4 sample output2 0
Example
We call the four contestants A, B, C, and D respectively. In this case, you may have two or more of the following four combat modes. In the worst case, you may have 0 points.
1234
Zhejiang ??? Result: Zhejiang Province ??? Result: Zhejiang Province ??? Result: Zhejiang Province ??? Result
No. 1 contestant AC negative ad negative BC victory BD negative
Contestant 2nd, BD, BC, AD, AC
Total score 0220 hint

 

This is quite similar to Tian Ji Ma of tyvj. It is still a matter of different regions. Let's look at your thoughts first:

  1. If we drop the worst person on the opposite side, the result must be the most satisfactory (excluding flattening)
  2. The same way can be achieved. The above applies to the best people.
  3. However, if neither of the above two points is sufficient, you can beat the best person on the opposite side with the worst person on your own.

He thinks that the magic of this method is that he will combine several complex mental computing methods through some sort of attention first, and then the solution will be correct. I can imagine the most challenging nature of the method under step 1 and Step 2. However, I have not yet confirmed the global most fundamental nature of this method.

Bzoj 1034: [zjoi2008]

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.