Problem :

https://www.hackerrank.com/challenges/two-arrays/problem


My Solution :

#!/usr/bin/env python3


def two_arrays(k, A, B):
A = sorted(A)
B = sorted(B, reverse=True)
for i in range(n):
if A[i] + B[i] < k:
return 'NO'
return 'YES'


q = int(input())
for _ in range(q):
n, k = map(int, input().split())
A = list(map(int, input().rstrip().split()))
B = list(map(int, input().rstrip().split()))
result = two_arrays(k, A, B)
print(result)