Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. n = int(input().strip())
  2. shoes = []
  3. count = 0
  4. for i in range(n):
  5. a,b = map(int,input().strip().split())
  6. attributes = set()
  7. for j in range(b):
  8. attributes.add(input().strip())
  9. shoes.append(attributes)
  10. for i in range(len(shoes)-1):
  11. for j in range(i + 1, len(shoes)):
  12. if len(shoes[i] & shoes[j]) > 0:
  13. count += 1
  14. print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement