You are viewing a single comment's thread. Return to all comments →
from itertools import product k,m = map(int, input().split()) listy = [] for _ in range(k): listy.append(list(map(int, input().split()))[1:]) najw = 0 for i in product(*listy): wartosc = sum(x**2 for x in i)%m najw = max(najw, wartosc) print(najw)
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 →
Solution