Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main()
- {
- ll n,m,x,res=0;
- map<ll,ll>disco;
- map<ll,ll>::iterator it,aux;
- while(cin>>n>>m)
- {
- if(n==0&&m==0)
- {
- break;
- }
- else
- {
- for(int i=0;i<n;i++)
- {
- cin>>x;
- disco.insert(make_pair(x,0));
- }
- for(int i=0;i<m;i++)
- {
- cin>>x;
- aux=disco.find(x);
- if(aux!=disco.end())
- {
- disco[x]++;
- }
- }
- for(it=disco.begin();it!=disco.end();it++)
- {
- if(it->second==1)
- {
- res++;
- //cout<<"--"<<it->first<<endl;
- }
- }
- cout<<res<<endl;
- disco.clear();
- res=0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement