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