You are viewing a single comment's thread. Return to all comments →
from itertools import product K, M = map(int, input().split()) Ls = [map(int, input().split()[1:]) for i in range(K)] def combs(*args): cs = list(product(*args)) return [sum(c**2 for c in c1) % M for c1 in cs] print(max(combs(*Ls)))
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 →