Quick actions

cmd+k|ctrl+k

Navigation

Languages

Like and unlike 

Snippet info

Language

Python

Visibility

public

Author

krishnakanth

Created

2022-12-09T02:42:09.367185Z

Updated

2022-12-09T02:52:55.185121Z

def main(arr,like,unlike):
    add = 0
    minus = 0
   # like = len(arr.intersection(like))
   # unlike = len(arr.intersection(unlike))
    for i in arr:
        if i in like:
            add += 1
        if i in unlike:
            minus +=1
    print(add - minus)


if __name__ =="__main__":
    n,m = input().split()
    arr = list(map(int,input().split()))
    like = set(map(int,input().split()))
    unlike = set(map(int,input().split()))
    main(arr,like,unlike)
INFO