-
Notifications
You must be signed in to change notification settings - Fork 1
/
PINPON.cpp
37 lines (36 loc) · 955 Bytes
/
PINPON.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <map>
#include <algorithm>
#include <iterator>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
while(true) {
int A,B;
cin >> A >> B;
if(A == 0 && B == 0)
break;
map<int, bool> Amap;
map<int, bool> Bmap;
int d;
for(int i=0; i<A; i++) {
cin >> d;
Amap[d] = true;
}
for(int i=0; i<B; i++) {
cin >> d;
Bmap[d] = true;
}
int ACount = 0, BCount = 0;
for(map<int,bool>::iterator it = Amap.begin(); it != Amap.end(); it++) {
if(it->second && !Bmap[it->first])
ACount++;
}
for(map<int,bool>::iterator it = Bmap.begin(); it != Bmap.end(); it++) {
if(it->second && !Amap[it->first])
BCount++;
}
cout << min(ACount, BCount) << endl;
}
return 0;
}