Last active
December 5, 2017 17:02
-
-
Save abidkhan484/8f843d8da39eed986109b5f1435bbd90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # the problem is not solved yet | |
| from itertools import product | |
| k, m = map(int, input().split()) | |
| li = [] | |
| for _ in range(k): | |
| pagli = list(map(int, input().split())) | |
| pagli.pop(0) | |
| li.append(pagli) | |
| maxim = -1 | |
| li = list(product(*li)) | |
| l = len(li[0]) | |
| for i in range(len(li)): | |
| total = 0 | |
| for p in range(l): | |
| total += (li[i][p]**2) | |
| total = total % m | |
| if total > maxim: | |
| maxim = total | |
| print(maxim) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment