#include <bits/stdc++.h>
using
namespace
std;
void
findLowerBound(pair<
int
,
int
> arr[],
pair<
int
,
int
>& p,
int
n)
{
auto
low = lower_bound(arr, arr + n, p);
cout <<
"lower_bound() for {2, 5}"
<<
" is at index: "
<< low - arr << endl;
}
void
findUpperBound(pair<
int
,
int
> arr[],
pair<
int
,
int
>& p,
int
n)
{
auto
up = upper_bound(arr, arr + n, p);
cout <<
"upper_bound() for {2, 5}"
<<
" is at index: "
<< up - arr << endl;
}
int
main()
{
pair<
int
,
int
> arr[]
= { { 1, 3 }, { 1, 7 }, { 2, 4 },
{ 2, 5 }, { 3, 8 }, { 8, 6 } };
pair<
int
,
int
> p = { 2, 5 };
int
n =
sizeof
(arr) /
sizeof
(arr[0]);
findLowerBound(arr, p, n);
findUpperBound(arr, p, n);
return
0;
}