Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given two integer arrays ~a~ and ~b~ of length ~n~ and an integer ~k~. Check if it is possible to turn array ~a~ into a permutation of ~b~ by selecting a number from a and changing it by no more than ~k~ units.
Input
- The first line contains two positive integers ~n~ and ~k~ ~(1 ≤ n ≤ 10^5, 1 ≤ k ≤ 10^9)~.
- The second line contains ~n~ positive integers ~a_1, a_2, …, a_n~ ~(1 ≤ a_i ≤ 10^9)~.
- The third line contains ~n~ positive integers ~b_1, b_2, …, b_n~ ~(1 ≤ b_i ≤ 10^9)~.
Output
- In ra
YES
nếu có thể, ngược lại in raNO
.
Example Input 1
3 1
2 3 4
2 2 3
Example Output 1
NO
Example Input 2
3 2
2 3 4
2 2 3
Example Output 2
YES
Bình luận