We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* Enter your code here. Read input from STDIN. Print output to STDOUT */intn=0;intx=0;vector<int>vek;cin>>n;while(n>0){cin>>x;vek.push_back(x);n--;}intq=0;cin>>q;while(q>0){inty=0;vector<int>::iteratorit;cin>>y;it=lower_bound(vek.begin(),vek.end(),y);if(*it!=y){cout<<"No "<<(it-vek.begin()+1)<<'\n';}else{cout<<"Yes "<<(it-vek.begin()+1)<<'\n';}q--;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lower Bound-STL
You are viewing a single comment's thread. Return to all comments →
c++14