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