#P14024. [ICPC 2024 Nanjing R] 纸条

[ICPC 2024 Nanjing R] 纸条

Description

There are ww cells arranged in a row, numbered from 11 to ww from left to right. Among the cells, nn of them are red, mm of them are black, and the remaining (wnm)(w - n - m) cells are white.

You need to cover all the red cells with some strips. Each strip must cover kk continuous cells. Find a way to cover all red cells while satisfying all the following constraints:

  • Each red cell is covered by a strip.
  • No black cell is covered by a strip.
  • No two strips cover the same cell. That is, each cell is covered by at most one strip.
  • The number of strips used is as small as possible.

Input Format

There are multiple test cases. The first line of the input contains an integer TT indicating the number of test cases. For each test case:

The first line contains four integers nn, mm, kk and ww (1n,m1051 \le n, m \le 10^5, 1kw1091 \le k \le w \le 10^9, n+mwn + m \le w), indicating the number of red cells, the number of black cells, the length of each strip and the total number of cells.

The second line contains nn integers a1,a2,,ana_1, a_2, \cdots, a_n (1aiw1 \le a_i \le w), indicating that cell aia_i is red.

The third line contains mm integers b1,b2,,bmb_1, b_2, \cdots, b_m (1biw1 \le b_i \le w), indicating that cell bib_i is black.

It's guaranteed that the given (n+m)(n + m) cells are distinct. It's also guaranteed that neither the sum of nn nor the sum of mm of all test cases will exceed 2×1052 \times 10^5.

Output Format

For each test case:

If it is possible to cover all the red cells while satisfying all constraints, first output one line containing one integer cc indicating the smallest number of strips used. Then output another line containing cc integers l1,l2,,lcl_1, l_2, \cdots, l_c (1liwk+11 \le l_i \le w - k + 1) separated by a space, where lil_i is the left-most cell covered by the ii-th strip. If there are multiple valid answers, you can output any of them.

If it is not possible to do so, just output -1\texttt{-1} in one line.

4
5 2 3 16
7 11 2 9 14
13 5
3 2 4 11
6 10 2
1 11
2 1 2 6
1 5
3
2 1 2 6
1 5
2
4
6 2 14 9
-1
2
1 4
-1