-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNoIdea.py
More file actions
29 lines (27 loc) · 785 Bytes
/
NoIdea.py
File metadata and controls
29 lines (27 loc) · 785 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
# solution notes
# set is faster than list when it comes to searching operation.(provides better time complexity)
# list-comprehension:
# sum([(i in A) - (i in B) for i in array])
# true - false evaluates to 1
# false - true evaluates to -1
# true - false evaluates to 1
# final list = [1, -1, 1]
# sum of final list evaluates to 1
n, m = input().split()
array = input().split()
A = set(input().split())
B = set(input().split())
print(sum([(i in A)-(i in B) for i in array]))
# code with time error:
#
# n, m = input().split()
# array = map(int, input().split())
# A = map(int, input().split())
# B = map(int, input().split())
# count = 0
# for item in array:
# if item in A:
# count += 1
# elif item in B:
# count -= 1
# print(count)