You are viewing a single comment's thread. Return to all comments →
from itertools import * K, M = map(int, input().split()) lists = [] for i in range(K): lists.append(list(map(lambda x: int(x)**2, input().split()[1:]))) pr = list(product(*lists)) maximum = max(map(lambda x: sum(x) % M, pr)) print(maximum)
Seems like cookies are disabled on this browser, please enable them to open this website
Maximize It!
You are viewing a single comment's thread. Return to all comments →