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