Skip to content

Commit

Permalink
[create (숫자 카드2.py)]
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoojin-An committed Aug 4, 2024
1 parent 90477a5 commit 9f3c7ac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Baekjoon/이진 탐색/숫자 카드2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import bisect

N = int(input())
ns = sorted(map(int, input().split()))
M = int(input())
ms = map(int, input().split())

for val in ms:
left_idx = bisect.bisect_left(ns, val)
if left_idx < N and ns[left_idx] == val:
right_idx = bisect.bisect(ns, val)
print(right_idx - left_idx, end = " ")
else:
print(0, end = " ")

0 comments on commit 9f3c7ac

Please sign in to comment.