You are viewing a single comment's thread. Return to all comments →
from itertools import product numbers = {} S = 0 K, M = map(int, input().split()) for i in range(K): _, *numbers[i] = map(int, input().split()) S = max(S, max(sum(x ** 2 for x in combo) % M for combo in product(*numbers.values()))) 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 →