This is supposed to be Problem C
Ninetail doesn't love playing card game. But XGN forced her to do so because she has the ability to turn anything into one another. So she did!
Now Ninetail is playing card games with Doragon. Ninetail has N cards, the i-th card has an attack point of $A_i$. Doragon has M cards, the i-th card has an defense point of $B_i$
The turn goes as follows:
Ninetail wants to end this stupid game quickly know what's the maximum possibility she could win if only she plays optimally.
The first line contains integers N,M
The next line contains N integers, the array A
The next line contains M integers, the array B
Let the answer be P.
Print $P\times M!$ module $10^9+7$
[Input]
5 3
1 2 3 4 5
2 3 5
[Output]
2
[Explain]
the best C={3,4,5}:
{3,4,5} vs {2,3,5} win
{3,4,5} vs {2,5,3} NOT win because 4<5
{3,4,5} vs {3,2,5} win
{3,4,5} vs {3,5,2} NOT win
{3,4,5} vs {5,3,2} NOT win
{3,4,5} vs {5,2,3} NOT win
$1\leq M\leq N\leq 2*10^5,1\leq A_i,B_i\leq 10^9$
M in all testcases(N will be at most 3*M):
Testcase # | M |
---|---|
1 | 1 |
2 | 2 |
3 | 3 |
4 | 5 |
5 | 10 |
6 | 20 |
7 | 40 |
8 | 100 |
9 | 200 |
10 | 500 |
11 | 1000 |
12 | 2000 |
13 | 5000 |
14 | 10000 |
15 | 20000 |
16 | 50000 |
17 | 100000 |
18 | 100000 |
19 | 200000 |
20 | 200000 |