Author: | A. Baranov | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
There are two integer arrays A and B, of length N each.
Your program must generate lexicographically minimal permutation of A, satisfying conditions:
Ai ≤ Bi, i = 1, 2, …, N
Input contains integer N, followed by 2 ⋅ N integers: array A, then array B.
Output must contain N integers — resulting permutation.
If the solution does not exist, output a single number − 1.
0 ≤ Ai, Bi ≤ 109, 1 ≤ N ≤ 2 ⋅ 105
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|