传统题 1000ms 128MiB

Basketball

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Basketball is a well known sport that everybody loves it, so does ssw. One day, ssw assembled 2n players. They are told to line up as two teams to practice passing the basketball. For each team, there are n players. They are required to pass the ball to the players of the other team. Because of their different physical ability, they can only pass the ball to the players in a certain range(that depends on themselves). ssw wants to know, with the best strategy, what is the minimum number of the pass that is needed to be made to let the ball passes from the left of two teams to the right(which team to begin with and which team to end with are not important).** **As ssw is a member of NCUST ACM Association, he decided to write a program to solve that.

Input Format

There are T testcases.

The first line contains a positive integer T(1T10)T(1\leq T \leq 10), denoting the amount of testcases.

For each testcase:

The first line of the input contains a positive integer n(1n104)n(1\leq n\leq10^4), denoting the amount of the basketball players in one team.

The second line of the input contains nn positive integer ai(1n108)a_i(1\leq n\leq10^8) denoting the range that player aia_i ,could pass through.

The third line of the input contains nn positive integer bi(1n108)b_i(1\leq n\leq10^8), denoting the range that player bib_i could pass through.

It is guarateed that the sum of n will not exceed 10510^5

Output Format

For each testcase:

You should print the mininum number of the pass in a single line.

1
10
1 2 3 1 1 1 1 1 1 1
2 2 1 1 1 1 1 1 1 1​
6

2020HBCPC训练赛

未参加
状态
已结束
规则
ACM/ICPC
题目
8
开始于
2020-9-12 13:00
结束于
2020-9-12 17:00
持续时间
4 小时
主持人
参赛人数
15