| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
Alice and Bob play a game.
Alice has $$$n$$$ cards and Bob has $$$n$$$ cards. Each card has an integer power.
You are given two arrays $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$, where $$$a_j$$$ is the power of Alice's $$$j$$$-th card and $$$b_i$$$ is the power of Bob's $$$i$$$-th card.
The game consists of $$$n$$$ rounds. In round $$$i$$$ $$$(1 \le i \le n)$$$, Bob plays his $$$i$$$-th card (with power $$$b_i$$$). Then Alice chooses any one of her remaining (unused) cards and plays it against Bob's card. If the power of Alice's chosen card is strictly greater than $$$b_i$$$, Alice wins this round.
Each Alice card can be used at most once.
Find the maximum number of rounds Alice can win if she plays optimally.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5 \cdot 10^5$$$.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases.
Each test case consists of three lines:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print one integer — the maximum number of rounds Alice can win.
4 3 7 1 3 9 2 5 2 6 2 6 6 5 8 9 2 1 7 4 5 3 1 6 1 7 6
2 0 4 1
| Name |
|---|

