File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 52
52
| 8/6 | | | |
53
53
| 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 ) | 문자열 집합 스택 |
54
54
| 8/8 | | ** _ [ 10825] ( https://www.acmicpc.net/problem/10825 ) _ ** | 정렬 |
55
- | 8/9 | | | |
55
+ | 8/9 | | ** _ [ 11663 ] ( https://www.acmicpc.net/problem/11663 ) _ ** | 이분탐색 |
56
56
| 8/10 | | | |
57
57
| 8/11 | | | |
58
58
| 8/12 | | | |
You can’t perform that action at this time.
0 commit comments