CF2164C Dungeon
Description
You are now in a dungeon with $ n $ swords, facing $ m $ monsters.
The damage of the $ i $ -th sword is $ a_i $ , and the life value of the $ i $ -th monster is $ b_i $ . A sword with damage $ x $ can kill a monster with life value $ y $ if and only if $ x \ge y $ .
After killing the $ i $ -th monster with a sword of damage $ x $ , this sword disappears. Then, if $ c_i > 0 $ , you will obtain a new sword with damage $ \max(x, c_i) $ ; otherwise, you gain nothing.
Now you want to know the maximum number of monsters you can kill. Note that you can kill each monster at most once.
Input Format
Each test contains multiple test cases. The first line contains the number of test cases $ T $ ( $ 1 \le T \le 10^4 $ ). The description of the test cases follows.
The first line of each test case contains two integers $ n $ and $ m $ ( $ 1 \le n,m \le 2 \cdot 10^5 $ ).
The second line of each test case contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 10^9) $ .
The third line of each test case contains $ m $ integers $ b_1, b_2, \ldots, b_m $ ( $ 1 \le b_i \le 10^9) $ .
The fourth line of each test case contains $ m $ integers $ c_1, c_2, \ldots, c_m $ ( $ 0 \le c_i \le 10^9) $ .
It is guaranteed that the sum of $ n $ and $ m $ over all test cases does not exceed $ 2 \cdot 10^5 $ , respectively.
Output Format
For each test case output one integer — the maximum number of monsters you can kill.
Explanation/Hint
[Visualizer link](https://codeforces.com/assets/contests/2164/C_oochei8Kaijaiz8hah8l.html)
In the first test case, you can first kill monster #1 using sword #1, and obtain a new sword with damage $ \max(2,3)=3 $ . You can then use this sword to kill monster #2.
In the second test case, you can't obtain any new swords because all $ c_i=0 $ , so you can only kill monster #1 and #2 with your two existing swords.