Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, d = map(int, input().split())
- a = sorted(list(map(int, input().split())))
- l = 0
- r = n-1
- answ = 0
- while l <= r:
- if a[l] + a[r] <= d:
- answ += 1
- r -= 1
- l += 1
- else:
- r -= 1
- answ += 1
- print(answ)
Advertisement
Add Comment
Please, Sign In to add comment