You are viewing a single comment's thread. Return to all comments →
easy code
int main() { vector<int>v; int n; cin>>n; for(int i=0;i<n;i++){ int cl; cin>>cl; v.push_back(cl); } int test; cin>>test; sort(v.begin(),v.end()); for(int i=0;i<test;i++){ int x; cin>>x; auto it = lower_bound(v.begin(),v.end(),x); if(x == *it) cout<<"Yes"<<" "<<(it-v.begin()+1)<<endl; else { cout<<"No"<<" "<<(it-v.begin()+1)<<endl; } } return 0; }
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 →
easy code