Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Created February 9, 2015 13:04
Show Gist options
  • Save theoremoon/da4d27e55fe78e46ee76 to your computer and use it in GitHub Desktop.
Save theoremoon/da4d27e55fe78e46ee76 to your computer and use it in GitHub Desktop.
/*
* AOJ 10031
* AC
*/
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, m, res = 0;
int p[101000];
cin >> n;
for (int i = 0; i < n; ++i)
cin >> p[i];
sort(p, p+n);
cin >> m;
for (int i = 0; i < m; ++i) {
int a = 0; cin >> a;
res += binary_search(p, p+n, a);
}
cout << res << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment