-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacme.c
65 lines (53 loc) · 961 Bytes
/
acme.c
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "stdio.h"
#define get getchar_unlocked
inline int scan2(){
int n=0,s=1;
char p=get();
if(p=='-') s=-1;
while((p<'0'||p>'9')&&p!=EOF&&p!='-') p=get();
if(p=='-') s=-1,p=get();
while(p>='0'&&p<='9') { n = (n<< 3) + (n<< 1) + (p - '0'); p=get(); }
return n*s;
}
int printIntersection(int arr1[], int arr2[], int m, int n)
{
int i = 0, j = 0,count = 0;
count = 0;
while(i < m && j < n)
{
if(arr1[i] < arr2[j])
i++;
else if(arr2[j] < arr1[i])
j++;
else
{
count++;
i++;
j++;
}
}
return count;
}
int main(){
int common,i,m,n,s[110],t[110],testcases = 0,k = 0;
testcases = scan2();
while(testcases--){
common = 0;
k = 0;
m = 0;
n = 0;
m = scan2();
for(i=0;i<m;i++)
s[i] = scan2();
n = scan2();
for(i=0;i<n;i++)
t[i] = scan2();
common = printIntersection(s,t,m,n);
if(m>=n)
k = m;
else
k = n;
printf("%d\n",k-common);
}
return 0;
}