We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Enter your code here. Read input from STDIN. Print output to STDOUT
n,m = map(int,input().split())
array = list(map(int,input().split()))
A = set(map(int,input().split()))
B = set(map(int,input().split()))
happiness = 0
for i in array:
if i in A:
happiness += 1
if i in B:
happiness -= 1
else:
happiness = happiness
print(happiness)
# Enter your code here. Read input from STDIN. Print output to STDOUTn,m=map(int,input().split())arrn=list(map(int,input().split()))# 2 disjoint setsAt=set(map(int,input().split()))Bt=set(map(int,input().split()))happy=0foriinarrn:ifiinAt:happy+=1ifiinBt:happy-=1else:happy=happyprint(happy)
That's it! I am done with this stupid website. It is full of confusing and ambiguous descriptions! I am consuming more time to unserstand the problem than to actually solve it. The description of the problem should be clear and concise. I would not recommend anyone who was has come here to practice coding here. This website will make you feel down like I was feeling down since 2 days.
Enter your code here. Read input from STDIN. Print output to STDOUT
n,m = map(int,input().split()) array = list(map(int,input().split())) A = set(map(int,input().split())) B = set(map(int,input().split())) happiness = 0 for i in array: if i in A: happiness += 1 if i in B: happiness -= 1 else: happiness = happiness print(happiness)
Hi there! Solution with sets
That's it! I am done with this stupid website. It is full of confusing and ambiguous descriptions! I am consuming more time to unserstand the problem than to actually solve it. The description of the problem should be clear and concise. I would not recommend anyone who was has come here to practice coding here. This website will make you feel down like I was feeling down since 2 days.
I got this wrong initially because this note is ambiguous:
which I read as instructing me to not count duplicate elements so I made a set from the array which gives the wrong answer.