We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Itertools
- Maximize It!
- Discussions
Maximize It!
Maximize It!
Sort by
recency
|
1120 Discussions
|
Please Login in order to post a comment
Here's the other method but without taking any inputs for my convenience:
I couldn't find a single easy to understand way, So here is mine with extra comments to make it easier
from itertools import product
num,num1=input().split()
list1=[]
for i in range(int(num)):
max_value=0
for cury in product(*list1):
print(max_value)
Enter your code here. Read input from STDIN. Print output to STDOUT
k,m = map(int, input().split()) inp_list = []
for _ in range(k): _, *nums = map(int, input().split()) inp_list.append([x * x % m for x in nums])
curr_results = {0}
for li in inp_list: new_results = set() for res in curr_results: for ele in li: new_results.add((res + ele) % m) curr_results = new_results print(max(curr_results))