You are viewing a single comment's thread. Return to all comments →
import itertools k, m = [int(i) for i in input().split()] lists = [[int(j)**2 for j in input().split()[1:]] for i in range(k)] remainders = [sum(l) % m for l in itertools.product(*lists)] print(max(remainders))
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 →