Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- n = int(input())
- product_min = {}
- product_current = {}
- for _ in range(n):
- visit = input().split()
- num_of_products = visit[0]
- products = visit[1:]
- for p in product_current:
- if p in products:
- product_min[p] = min(
- product_min.get(p, product_current[p]), product_current[p]
- )
- else:
- product_current[p] += 1
- for p in products:
- if p not in product_current:
- product_current[p] = 0
- print(len(product_min))
- for p, v in sorted(product_min.items()):
- print(p, v + 1)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement