|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||0||0||0||0.000%|
The online retailer Amagoogsoftbook currently offers $N$ different so-called ``home assistants'', which it wants to recommend to its customers. For this recommendation, they wish to rank all the assistants. The quality of this ranking is not very important -- multiple assistants may even be assigned the same rank -- but they wish to maximize the number of distinct ranks assigned, to lessen the decision fatigue of their customers.
To ensure that the ranking is not completely arbitrary, they have collected for each assistant $i$ two measurements $a_i$ and $b_i$ -- the quality of the jokes the assistant can tell and how nice are the compliments the assistant is able to give (clearly these are the two most important aspects). These measurements are of course somewhat subjective, so we wish to ignore small differences in them. However, if for two given assistants $i$ and $j$ we have that $a_i + K < a_j$ or $b_i + K < b_j$, the ranking of assistant $j$ must be the same or higher than the ranking of assistant $i$. This rule may force two products to be given the same ranking, for example if an assistant $i$ gives much better puns than assistant $j$, while assistant $j$ gives the superior self-esteem boosts.
What is the maximum number of distinct ranks, taken over all possible rankings?
The first line contains the integers $1 \le N \le 100\,000$ and $0 \le K \le 10^9$ -- the number of assistants and the measurement difference limit as described in the statement. The next line contains the $N$ integers $a_1, a_2, \dots, a_N$. The next line contains the $N$ integers $b_1, b_2, \dots, b_N$.
All measurements are between $0$ and $10^9$.
Output a single integer: the maximum number of distinct ranks.
2 10 1 12 1 13
2 10 1 5 1 12
2 10 1 5 1 4
2 10 1 5 4 1
2 10 1 12 13 1