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