Skip to content

Commit 505a225

Browse files
committed
[BOJ] #11663.선분위의 점 / 실버3 / 30(X)
1 parent 60fdf44 commit 505a225

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
input = sys.stdin.readline
3+
from bisect import bisect_left, bisect_right
4+
5+
N, M = map(int, input().split())
6+
points = list(map(int, input().split()))
7+
lines = [tuple(map(int, input().split())) for _ in range(M)]
8+
9+
points.sort()
10+
11+
counts = []
12+
for start, end in lines:
13+
left = bisect_left(points, start)
14+
right = bisect_right(points, end)
15+
counts.append(right - left)
16+
17+
print("\n".join(map(str, counts)))

0 commit comments

Comments
 (0)