#P17147. [ICPC 2017 Xi'an R] Lovers

    ID: 19425 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>贪心2017排序ICPC双指针 two-pointer西安

[ICPC 2017 Xi'an R] Lovers

Problem Description

One day nn girls and nn boys come to Xi’an to look for a mate. Each girl has a value a[i]a[i], each boy has a value b[i]b[i]. Girl ii and boy jj will fall in love only if a[i]+b[j]ka[i] + b[j] \ge k.

Please help them make pairs as many as possible.

Input Format

Several test cases.

First line an integer TT (1T101 \le T \le 10). Indicates the number of test cases.

Then TT test cases follow. Each test case begins with two integers NN, KK (1N200000, 0K1091 \le N \le 200000,\ 0 \le K \le 10^9). The next line has NN integers indicating a[1]a[1] to a[N]a[N] (0a[i]1090 \le a[i] \le 10^9). The next line has NN integers indicating b[1]b[1] to b[N]b[N] (0b[i]1090 \le b[i] \le 10^9).

Output Format

For each test case, print the answer in a single line.

1
3 4
1 2 3
1 2 3
3