Created
January 7, 2017 01:56
-
-
Save dudelson/d182ec543602a2dc9b9a141cd4095a1a to your computer and use it in GitHub Desktop.
My solution for UVA 11849
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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