You are viewing a single comment's thread. Return to all comments →
import itertools K, M = map(int, input().split()) lst = [] S = 0 for i in range(K): lst.append(list(map(int, input().split()))[1:]) for ele in itertools.product(*lst): add = sum(list(map(lambda x: x*x, ele))) S = max(add % M, S) print(S)
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 →