You are viewing a single comment's thread. Return to all comments →
from functools import reduce def evaluate(arr): sq = list(map(lambda x : x**2, arr)) sum_1 = reduce(lambda x, y :x+y, sq ) return sum_1 s = list(map(int, input().split())) count_arr = s[0] M = s[1] Sum = 0 all_arr = [] for _ in range(count_arr): arr = list(map(int, input().split())) all_arr.append(arr[1:]) combinations = list(product(*all_arr)) result = [] for comb in combinations: result.append(evaluate(list(comb))%M) print(max(result))
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 →