[HackerRank][Python3] Permuting Two Arrays
2018. 9. 8. 23:32 |
프로그래밍/HackerRank
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)
'프로그래밍 > HackerRank' 카테고리의 다른 글
[HackerRank][Python3] Tower Breakers (0) | 2018.09.09 |
---|---|
[HackerRank][Python3] Game of Stones (0) | 2018.09.09 |
[HackerRank][Python3] Sum vs XOR (0) | 2018.09.09 |
[HackerRank][Python3] Maximizing XOR (0) | 2018.09.08 |
[HackerRank][Python3] Jim and the Orders (0) | 2018.09.08 |
[HackerRank][Python3] Largest Permutation (0) | 2018.09.08 |
[HackerRank][Python3] Priyanka and Toys (0) | 2018.09.08 |
[HackerRank][Python3] Beautiful Pairs (0) | 2018.09.08 |
최근에 달린 댓글 최근에 달린 댓글