#include <bits/stdc++.h>
using
namespace
std;
void
findLowerBound(
map<pair<
int
,
int
>,
int
>& mp,
pair<
int
,
int
>& p)
{
auto
low = mp.lower_bound(p);
cout <<
"lower_bound() for {2, 5}"
<<
" is: {"
<< (*low).first.first <<
", "
<< (*low).first.second
<<
"}"
<< endl;
}
void
findUpperBound(
map<pair<
int
,
int
>,
int
>& mp,
pair<
int
,
int
>& p)
{
auto
up = mp.upper_bound(p);
cout <<
"upper_bound() for {2, 5}"
<<
" is: {"
<< (*up).first.first <<
", "
<< (*up).first.second
<<
"}"
<< endl;
}
int
main()
{
map<pair<
int
,
int
>,
int
> mp;
mp.insert({ { 2, 3 }, 8 });
mp.insert({ { 4, 1 }, 5 });
mp.insert({ { 7, 1 }, 3 });
mp.insert({ { 9, 3 }, 1 });
mp.insert({ { 5, 0 }, 3 });
pair<
int
,
int
> p = { 2, 5 };
findLowerBound(mp, p);
findUpperBound(mp, p);
return
0;
}