Skip to content

Instantly share code, notes, and snippets.

@dudelson
Created January 7, 2017 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudelson/d182ec543602a2dc9b9a141cd4095a1a to your computer and use it in GitHub Desktop.
Save dudelson/d182ec543602a2dc9b9a141cd4095a1a to your computer and use it in GitHub Desktop.
My solution for UVA 11849
#include <iostream>
#include <set>
using namespace std;
#define ll long long
ll n, m, x, ans;
set<ll> cds;
int main() {
while(cin >> n >> m, n||m) {
cds.clear();
while(n--) {
cin >> x;
cds.insert(x);
}
ans = 0;
while(m--) {
cin >> x;
if(cds.find(x) != cds.end()) ans++;
}
cout << ans << '\n';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment