You are viewing a single comment's thread. Return to all comments →
from itertools import product if __name__ == '__main__': k, n = map(int, input().strip().split()) arrays = [] for _ in range(1, k + 1): arr = list(input().strip().split())[1:] arrays.append(arr) s_max = 0 for combo in product(*arrays): sum_combo = sum(int(x) ** 2 for x in combo) current_s_max = sum_combo % n s_max = max(current_s_max, s_max) print(s_max)
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 →