Skip to content

Instantly share code, notes, and snippets.

@uenoku
Created December 16, 2016 01:55
Show Gist options
  • Save uenoku/6a56bafb6ab8d46492ae7c7955536200 to your computer and use it in GitHub Desktop.
Save uenoku/6a56bafb6ab8d46492ae7c7955536200 to your computer and use it in GitHub Desktop.
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> P;
lli MOD = 1000000007;
int main()
{
int n;
while (cin >> n) {
set<int> s, t;
int a;
rep(i, n)
{
cin >> a;
s.insert(a);
}
cin >> n;
rep(i, n)
{
cin >> a;
t.insert(a);
}
int ans = 0;
for (auto l : s) {
if (t.find(l) != t.end())
ans++;
}
cout << ans << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment