Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<vector>
- #include<map>
- #include<algorithm>
- using namespace std;
- vector<long long>a;
- map<long long,long long>m;
- int main()
- {
- int test;
- int p,q;
- scanf("%d",&test);
- while(test--)
- {
- long long num;
- scanf("%d %d",&p,&q);
- for(int i=0;i<p;i++)
- {
- scanf("%lld",&num);
- m[num]++;
- a.push_back(num);
- }
- for(int i=0;i<q;i++)
- {
- scanf("%lld",&num);
- m[num]--;
- a.push_back(num);
- }
- sort(a.begin(),a.end());
- a.erase(unique(a.begin(),a.end()),a.end());
- long long res=0;
- for(long long i=0;i<a.size();i++){if(m[a[i]]!=0)res+=abs(m[a[i]]);}
- printf("%lld\n",res);
- a.clear();m.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement