Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <iterator>
- using namespace std;
- long a[1000004],b[1000004],i;
- int main()
- {
- long n,m;
- cout<<"n=";cin>>n;
- for (i=1;i<=n;i++)
- cin>>a[i];
- cout<<"m=";cin>>m;
- for (i=1;i<=m;i++)
- cin>>b[i];
- sort(a+1, a+n+1);
- sort(b+1, b+m+1);
- vector<int> v_intersection;
- set_intersection(a+1, a+n+1,b+1, b+m+1,back_inserter(v_intersection));
- for(int x : v_intersection)
- cout << x << ' ';
- }
- //*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement