about summary refs log tree commit diff
path: root/2ndary/10/CSP-KT2/zpairs.c
blob: d0d6186d5f34fc6243f65ec24e6dab6a27966312 (plain) (blame)
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
#include <stdio.h>

int main()
{
	short m, n, i, j, v = 0;
	long a[10000], b;

	scanf("%hd %hd", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%ld", &a[i]);

	i = 0;
	for (j = 0; j < m; j++) {
		if (i >= n)
			break;
		scanf("%ld", &b);
		while (b > a[i])
			i++;
		if (b == a[i]) {
			v++;
			i++;
		}
	}

	printf("%hd\n", v);

	return 0;
}