-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathNo Idea!.py
88 lines (45 loc) · 1.48 KB
/
No Idea!.py
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# There is an array of integers. There are also disjoint sets, and , each containing integers. You like all the integers in set and dislike all the integers in set . Your initial happiness is . For each integer in the array, if , you add to your happiness. If , you add
# to your happiness. Otherwise, your happiness does not change. Output your final happiness at the end.
# Note: Since
# and
# are sets, they have no repeated elements. However, the array might contain duplicate elements.
# Constraints
# Input Format
# The first line contains integers
# and separated by a space.
# The second line contains integers, the elements of the array.
# The third and fourth lines contain integers, and
# , respectively.
# Output Format
# Output a single integer, your total happiness.
# Sample Input
# 3 2
# 1 5 3
# 3 1
# 5 7
# Sample Output
# 1
# Explanation
# You gain
# unit of happiness for elements and in set . You lose unit for in set . The element in set
# does not exist in the array so it is not included in the calculation.
# Hence, the total happiness is
# .
# happiness = 0
# list1 = []
# list2 = []
# n,m = input().split()
# narray = input().split()
# A = input().split()
# B = input().split()
# for i in narray:
# if i in A:
# happiness += 1
# if i in B:
# happiness -= 1
# print(happiness)
n, m = input().split()
sc_ar = input().split()
A = set(input().split())
B = set(input().split())
print(sum([(i in A) - (i in B) for i in sc_ar]))