import sys
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
N = int(input())
R = sorted(list(map(int, input().split())))
M = int(input())
F = list(map(int, input().split()))
for i in range(M):
print(bisect_right(R, F[i]) - bisect_left(R, F[i]), end= " ")
bisect의 존재를 배워서 그런가, 이 문제는 되게 쉬웠다...
bisect은 이진 탐색할 시, python에서 주어지는 라이브러리이다.
bisect는 탐색한 리스트의 인덱스 값을 반환해준다.
숫자 카드에 같은 수가 적혀 있는 경우는 없다는 조건을 참고하여 코드를 짜보았다.
\n
이 포함되어 출력된다., end = " "
를 추가하면 됨. 출력 예시: 1 0 0 1 1 0 0 1
*
를 붙여도 된다. print(*ans)
join()
을 사용할 수도 있다. 이때는 대신 string이어야 함. print(" ".join(map(str, ans)))