|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||3||3||3||100.000%|
You have two permutations of n elements, p1, p2, . . . , pn and q1, q2, . . . , qn, and one integer k.
You need to find two integer arrays, a and b, with the following properties:
The first line of the input contains two integers n and k: the number of elements and the required number of cool pairs (1 ≤ n ≤ 300 000, 0 ≤ k ≤ n·(n−1)/2).
The second line contains n space-separated integers: the permutation p1, p2, . . . , pn.
The third line contains n space-separated integers: the permutation q1, q2, . . . , qn.
It is guaranteed that each integer from 1 to n appears exactly once in each permutation.
If there is no such pair of integer arrays that the number of cool pairs is equal to k, print “No” on a single line.
Otherwise, print “Yes” on the first line, and print the arrays a and b on the next two lines. Separate array elements by spaces.
5 3 3 5 1 2 4 1 2 3 4 5
Yes 2 3 -1 5 1 -5 -3 -2 -2 0