-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path688B.cpp
More file actions
39 lines (37 loc) · 802 Bytes
/
688B.cpp
File metadata and controls
39 lines (37 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, m;
scanf("%d %d", &n, &m);
int arr[n];
int arr2[m];
int cnt1[101];
int cnt2[101];
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
for (int i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
cnt1[arr[i]]++;
}
for (int i = 0; i < m; i++)
{
scanf("%d", &arr2[i]);
cnt2[arr2[i]]++;
}
int cnt = 0;
for (int i = 0; i < 101; i++)
{
if(cnt1[i] != 0 && cnt1[i]==cnt2[i]){
cnt++;
}
}
printf("%d\n",cnt);
}
}