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