解法:
桶
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define endl '\n'
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
vector<int> tong(1001);
int t = 4;
int k, pai;
long long suma = 0, sum = 0;
while (t--) {
cin >> k;
while (k--) {
cin >> pai;
tong[pai]++;
}
}
for (int i = 1; i < 1001; i++) {
if (!tong[i]) continue;
suma++;
sum += tong[i];
}
cout << suma * 4 - sum << endl;
return 0;
}