Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. typedef long long ll;
  5. int main()
  6. {
  7. ll n,m,x,res=0;
  8. map<ll,ll>disco;
  9. map<ll,ll>::iterator it,aux;
  10. while(cin>>n>>m)
  11. {
  12. if(n==0&&m==0)
  13. {
  14. break;
  15. }
  16. else
  17. {
  18. for(int i=0;i<n;i++)
  19. {
  20. cin>>x;
  21. disco.insert(make_pair(x,0));
  22. }
  23. for(int i=0;i<m;i++)
  24. {
  25. cin>>x;
  26. aux=disco.find(x);
  27. if(aux!=disco.end())
  28. {
  29. disco[x]++;
  30. }
  31. }
  32. for(it=disco.begin();it!=disco.end();it++)
  33. {
  34. if(it->second==1)
  35. {
  36. res++;
  37. //cout<<"--"<<it->first<<endl;
  38. }
  39. }
  40. cout<<res<<endl;
  41. disco.clear();
  42. res=0;
  43. }
  44. }
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement