You are viewing a single comment's thread. Return to all comments →
K, M = tuple(map(int, input().strip().split())) possible = {0} for i in range(K): count, *nums = list(map(int, input().split())) assert count == len(nums) vals = {pow(x, 2, M) for x in nums} possible = {(a + v) % M for a in possible for v in vals} print(max(possible))
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 →