Skip to content

Commit d300084

Browse files
authored
Add files via upload
1 parent ff1efbd commit d300084

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

No Idea!.py

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# 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
2+
3+
# to your happiness. Otherwise, your happiness does not change. Output your final happiness at the end.
4+
5+
# Note: Since
6+
# and
7+
8+
# are sets, they have no repeated elements. However, the array might contain duplicate elements.
9+
10+
# Constraints
11+
12+
13+
# Input Format
14+
15+
# The first line contains integers
16+
# and separated by a space.
17+
# The second line contains integers, the elements of the array.
18+
# The third and fourth lines contain integers, and
19+
20+
# , respectively.
21+
22+
# Output Format
23+
24+
# Output a single integer, your total happiness.
25+
26+
# Sample Input
27+
28+
# 3 2
29+
# 1 5 3
30+
# 3 1
31+
# 5 7
32+
33+
# Sample Output
34+
35+
# 1
36+
37+
# Explanation
38+
39+
# You gain
40+
# unit of happiness for elements and in set . You lose unit for in set . The element in set
41+
42+
# does not exist in the array so it is not included in the calculation.
43+
44+
# Hence, the total happiness is
45+
# .
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
# happiness = 0
67+
# list1 = []
68+
# list2 = []
69+
# n,m = input().split()
70+
# narray = input().split()
71+
# A = input().split()
72+
# B = input().split()
73+
# for i in narray:
74+
# if i in A:
75+
# happiness += 1
76+
# if i in B:
77+
# happiness -= 1
78+
# print(happiness)
79+
80+
n, m = input().split()
81+
82+
sc_ar = input().split()
83+
84+
A = set(input().split())
85+
B = set(input().split())
86+
print(sum([(i in A) - (i in B) for i in sc_ar]))
87+
88+

0 commit comments

Comments
 (0)