Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<algorithm>
- #define endl '\n'
- using namespace std;
- int main() {
- cin.tie(NULL);
- ios::sync_with_stdio(false);
- int a, b;
- while (cin >> a >> b) {
- vector<int> vec(a);
- for (auto& i : vec)
- cin >> i;
- while (b-- && cin >> a)
- cout << (binary_search(vec.begin(), vec.end(), a) ? lower_bound(vec.begin(), vec.end(), a) - vec.begin() + 1 : 0) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement