Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <set>
- #include <string>
- #include <algorithm>
- using namespace std;
- using ll = long long;
- void co(vector <int> v){
- for (auto x: v) cout<<x<<'\n';
- cout<<'\n';
- }
- int main()
- {
- int n, m;
- cin>>n>>m;
- vector <int> A(n);
- for (int &x: A) cin>>x;
- vector <int> B(m);
- for (int &x: B) cin>>x;
- for (int x: B){
- auto L = lower_bound(A.begin(), A.end(), x);
- int l = L - A.begin();
- auto R = upper_bound(A.begin(), A.end(), x);
- int r = R - A.begin();
- if (R - L == 0){
- cout<<0<<'\n';
- }
- else cout<<l + 1<<' '<<r<<'\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement