Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def binfind(a, x):
- l = -1
- r = len(a)
- while l + 1 < r:
- mid = (l+r) // 2
- if x <= a[mid]:
- r = mid
- else:
- l = mid
- return r
- n, k = map(int, input().split())
- a = [int(i) for i in input().split()]
- for i in range(k):
- x = int(input())
- print(binfind(a, x) + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement