practivceAlgorithm/백준
[백준][Python] 17393 다이나믹 룰러
findTheValue
2021. 11. 4. 22:59
B가 오름차순이므로 이분탐색 upperbound로 내가 들어갈 자리 찾는다.
import sys
input = sys.stdin.readline
from bisect import bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
answer = []
for idx, a in enumerate(A):
answer.append(bisect_right(B, a) - idx - 1)
print(*answer)