题目描述
Problem Description
Xiao Su is the factory director of a gong and drum factory. The factory has $n$ machines, and the $i$-th machine can produce $a_i$ gongs and drums in one day. Due to environmental, financial, and maintenance issues, in the next $n$ days, only one machine can be used each day, and each machine can only be used once in these $n$ days.
At the same time, Xiao Su has received $n$ orders, with the $i$-th order requiring the delivery of $b_i$ gongs and drums. Xiao Su wants to know if there is a reasonable arrangement for using machines and delivering orders, such that she can deliver one order each day in the next $n$ days.
Input Format
This problem contains multiple test cases within a single test point. The first line is an integer $T$ ($1 \leq T \leq 10$), indicating the number of test cases. For each test case, the input format is as follows:
The first line of each case is an integer $n$ ($1 \leq n \leq 10^3$), indicating the number of machines and orders.
The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \leq a_i \leq 10^4$), representing the number of gongs and drums each machine can produce in one day.
The third line contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \leq b_i \leq 10^4$), representing the number of gongs and drums required for each order.
Output Format
For each test case, output one line or three lines:
- If there is no way to deliver one order each day in the next $n$ days, output one line containing the string
No. - Otherwise, output three lines:
- The first line outputs
Yes. - The second line outputs $n$ integers, $x_1, x_2, \dots, x_n$, where $x_i$ represents the number of the machine used on the $i$-th day.
- The third line outputs $n$ integers, $y_1, y_2, \dots, y_n$, where $y_i$ represents the number of the order delivered on the $i$-th day.
$x_i$ and $y_i$ must be integers within the range $1 \sim n$, and each number must appear exactly once in $x_i, y_i$.
For cases where Yes is output, there may be multiple reasonable solutions. You can output any one of them. As long as your output is correct and reasonable, you will receive points.
Sample Input and Output
Sample Input #1
1
3
3 2 1
1 2 3
Sample Output #1
Yes
1 2 3
3 2 1
Sample Input #2
2
5
1 2 3 4 5
2 3 4 5 6
3
10 20 30
15 15 15
Sample Output #2
No
Yes
2 1 3
1 2 3
Notes
Sample 1 Explanation
- On the first day, use the machine numbered $1$ to produce $3$ gongs and drums, and deliver the order numbered $3$ with $3$ gongs and drums.
- On the second day, use the machine numbered $2$ to produce $2$ gongs and drums, and deliver the order numbered $1$ with $2$ gongs and drums.
- On the third day, use the machine numbered $3$ to produce $1$ gong and drum, and deliver the order numbered $1$ with $1$ gong and drum.
Sample 2 Explanation
We explain the second set of data:
- On the first day, use the machine numbered $2$ to produce $20$ gongs and drums. Deliver the order numbered $1$ with $15$ gongs and drums, leaving $5$.
- On the second day, use the machine numbered $1$ to produce $10$ gongs and drums, plus the previous $5$, totaling $15$ gongs and drums, and deliver the order numbered $2$ with $15$ gongs and drums, leaving $0$.
- On the third day, use the machine numbered $3$ to produce $30$ gongs and drums, totaling $30$ gongs and drums, and deliver the order numbered $2$ with $15$ gongs and drums, leaving $15$.
Hints
The sample output is not unique and is for reference only.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分