题目描述
Problem Description
In a one-dimensional world, there are $ N $ computers and $ N $ power supplies. The coordinate of the $ i $-th computer is $ a_i $, and the coordinate of the $ i $-th power supply is $ b_i $. It is guaranteed that these $ 2N $ coordinates are distinct.
Snuke wants to connect each computer to a power supply using cables. Each power supply can only be connected to one computer.
In how many ways can the total length of the cables be minimized? Find the answer modulo $ 10^9+7 $.
Input Format
The input is given from the standard input in the following format:
$ N $ $ a_1 $ : $ a_N $ $ b_1 $ : $ b_N $
Output Format
Output the number of ways to minimize the total length of the cables, modulo $ 10^9+7 $.
Sample Input and Output
Sample Input #1
2
0
10
20
30
Sample Output #1
2
Sample Input #2
3
3
10
8
7
12
5
Sample Output #2
1
Notes/Hints
Constraints
- $1\ \leq\ N\ \leq\ 10^5$
- $0\ \leq\ a_i,\ b_i\ \leq\ 10^9$
- Coordinates are integers.
- Coordinates are distinct.
Sample Explanation 1
There are two optimal ways to connect: $0-20,\ 10-30$ and $0-30,\ 10-20$. Both methods result in a total cable length of $ 40 $.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分