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