This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Problem : 12049 - Just Prune The List.cpp | |
* Author : ~menon. | |
***/ | |
#include <iostream> | |
#include <cstdio> | |
#include <set> | |
int main() | |
{ | |
std :: multiset <int> mymultiset; | |
std :: multiset <int> :: iterator it; | |
int t, ans; | |
//freopen("input.txt", "r", stdin); | |
scanf("%d", &t); | |
while(t--) | |
{ | |
int m, n; | |
mymultiset.clear(); | |
scanf("%d %d", &m, &n); | |
// input first serise into the set; | |
int num; ans = 0; | |
for(int i = 0; i < m; i++) { | |
scanf("%d", &num); | |
mymultiset.insert(num); | |
} | |
// input second serise and cheake if it is common; | |
for(int i = 0; i < n; i++) { | |
scanf("%d", &num); | |
// find the num and put it it into the it ; | |
it = mymultiset.find(num); | |
// if we find the value than erase this from the set; | |
if(it != mymultiset.end()) { | |
mymultiset.erase(it); | |
} | |
else { | |
++ans; | |
} | |
} | |
printf("%d\n", mymultiset.size() + ans ); | |
} | |
return 0; | |
} |
Comments
Post a Comment