You are viewing a single comment's thread. Return to all comments →
from itertools import product K, M = map(int, input().split()) A = [None]*K B = [None]*K for x in range(K): A[x], B[x] = input().split(' ', 1) B[x] = list(map(int, B[x].split())) SQ = [[v ** 2 for v in B[x]] for x in range(K)] MT = max((sum(x)%M for x in product(*SQ)), default = 0) print(MT)
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 →