Skip to content

Commit

Permalink
feat: add 11663
Browse files Browse the repository at this point in the history
  • Loading branch information
owl1753 committed Aug 9, 2024
1 parent 387b5f6 commit d17657b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions 11000/11663.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <algorithm>
using namespace std;

int points[100001];

int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> points[i];
sort(points, points + n);
while (m--) {
int start, end, result;
cin >> start >> end;
int startIndex = lower_bound(points, points + n, start) - points;
int endIndex = lower_bound(points, points + n, end) - points;
result = endIndex - startIndex - 1;
if (points[startIndex] >= start) result++;
if (points[endIndex] == end) result++;

if (startIndex == n) {
cout << 0 << "\n";
} else {
cout << result << "\n";
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
| 8/6 | | | |
| 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) | 문자열 집합 스택 |
| 8/8 | | **_[10825](https://www.acmicpc.net/problem/10825)_** | 정렬 |
| 8/9 | | | |
| 8/9 | | **_[11663](https://www.acmicpc.net/problem/11663)_** | 이분탐색 |
| 8/10 | | | |
| 8/11 | | | |
| 8/12 | | | |
Expand Down

0 comments on commit d17657b

Please sign in to comment.