| The 2023 ICPC Asia Hong Kong Regional Programming Contest (The 1st Universal Cup, Stage 2:Hong Kong) |
|---|
| Finished |
Grammy has a permutation of length $$$n$$$. She wants to delete some useless elements in the permutation, so she decided to use some magic tool to delete them. There are $$$k$$$ magic tools, the $$$i$$$-th of them can delete the maximum element of an interval of length exactly $$$\ell_i$$$. Each magic tool can be used at most once.
After each deletion, the length of the array decreases by one, and the neighbors of the deleted element become neighbors themselves.
Before using the tool, Grammy shows you her blueprint of the array after deletion. The new array consists of exactly $$$m$$$ distinct elements from $$$1$$$ to $$$n$$$. Please help Grammy to determine whether it is possible to delete the elements by using the magic tool, so that the result is equal to the blueprint.
There are multiple test cases.
The first line contains an integer $$$T$$$ ($$$1 \leq T \leq 10^5$$$), denoting the number of test cases.
For each test case:
The first line contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq m \leq n \leq 2 \cdot 10^5$$$, $$$1\leq k\leq 2\cdot 10^5$$$), denoting the length of the permutation, the length of the compressed array, and the parameter of the magic tool.
The second line contains $$$n$$$ distinct integers $$$a_i$$$ ($$$1 \leq a_i \leq n$$$), denoting the initial permutation. It is guaranteed that the elements are distinct.
The third line contains $$$m$$$ distinct integers $$$b_i$$$ ($$$1 \leq b_i \leq n$$$), denoting the array after compression. It is guaranteed that the elements are distinct.
The fourth line contains $$$k$$$ integers $$$\ell_i$$$ ($$$1 \leq \ell_i \leq n$$$), denoting the magic tools.
It is guaranteed that $$$\sum n\leq 2\cdot 10^5$$$ and $$$\sum k\leq 2\cdot 10^5$$$.
For each test case, output "YES" or "NO" on a separate line, denoting the answer to the problem.
35 2 35 1 3 2 45 21 2 45 5 51 2 3 4 51 2 3 4 51 2 3 4 53 2 23 1 23 22 3
YES YES NO
| Name |
|---|


