You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ vector vc; vector::iterator pos; int nums, num;
cin >> nums; for (int i = 0; i < nums; i++) { cin >> num; vc.push_back(num); } cin >> nums; for (int i = 0; i < nums; i++) { cin >> num; pos = lower_bound(vc.begin(), vc.end(), num); if (*pos == num) cout << "Yes " << (pos - vc.begin()) + 1 << endl; else cout << "No " << (pos - vc.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 →
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
vector vc; vector::iterator pos; int nums, num;
}