I have a vector of pair "v" which is sorted according to the first value of the pair. Now I want to find out the lower bound of vector "v" according to the first value of the pair -- while finding the lower bound I want to ignore the second.
int pl; cin>>pl;
vector<pair<int,int>> v;
for (int i = 0; i < n; i++){
int p,c; cin>>p>>c;
v.push_back({p,c});
}
sort(v.begin(),v.end());
auto it = lower_bound(v.begin(),v.end(),pl);
cout<<(*it)<<endl;
I want to find the lower bound of pl in the vector pair,according to the 1st value of pairs.I'm a newbie so please elaborate