Skip to content

Commit d17657b

Browse files
committed
feat: add 11663
1 parent 387b5f6 commit d17657b

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

11000/11663.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
using namespace std;
4+
5+
int points[100001];
6+
7+
int main() {
8+
ios::sync_with_stdio(false);
9+
cin.tie(NULL); cout.tie(NULL);
10+
int n, m;
11+
cin >> n >> m;
12+
for (int i = 0; i < n; i++) cin >> points[i];
13+
sort(points, points + n);
14+
while (m--) {
15+
int start, end, result;
16+
cin >> start >> end;
17+
int startIndex = lower_bound(points, points + n, start) - points;
18+
int endIndex = lower_bound(points, points + n, end) - points;
19+
result = endIndex - startIndex - 1;
20+
if (points[startIndex] >= start) result++;
21+
if (points[endIndex] == end) result++;
22+
23+
if (startIndex == n) {
24+
cout << 0 << "\n";
25+
} else {
26+
cout << result << "\n";
27+
}
28+
}
29+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| 8/6 | | | |
5353
| 8/7 | [NCPC 2007](https://www.acmicpc.net/category/detail/214) [coci1314-5](https://www.acmicpc.net/category/detail/1230) | [5052](https://www.acmicpc.net/problem/5052) [9935](https://www.acmicpc.net/problem/9935) | 문자열 집합 스택 |
5454
| 8/8 | | **_[10825](https://www.acmicpc.net/problem/10825)_** | 정렬 |
55-
| 8/9 | | | |
55+
| 8/9 | | **_[11663](https://www.acmicpc.net/problem/11663)_** | 이분탐색 |
5656
| 8/10 | | | |
5757
| 8/11 | | | |
5858
| 8/12 | | | |

0 commit comments

Comments
 (0)