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