Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input().strip())
- shoes = []
- count = 0
- for i in range(n):
- a,b = map(int,input().strip().split())
- attributes = set()
- for j in range(b):
- attributes.add(input().strip())
- shoes.append(attributes)
- for i in range(len(shoes)-1):
- for j in range(i + 1, len(shoes)):
- if len(shoes[i] & shoes[j]) > 0:
- count += 1
- print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement