You are viewing a single comment's thread. Return to all comments →
Here is my solution
x = [list(map(str, input().split()))] m1, m2 = int(x[0][0]), int(x[0][1]) x = [list(map(int, input().split())) for _ in range(m1)] for z in x: z.pop(0) pools = list(map(tuple, x)) elements = [[]] for pool in pools: elements = [x+[y] for x in elements for y in pool] S = list([sum(j**2 for j in i) for i in elements]) Smax = [i%m2 for i in S] print(max(Smax))
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 →
Here is my solution