Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import multiprocessing
- def worker_function(list_of_int):
- result = 0
- for i in range(len(list_of_int)):
- result += list_of_int[i] ** i
- return result
- def process_array(list_of_lists):
- with multiprocessing.Pool() as pool:
- result = pool.map(worker_function, list_of_lists)
- return sum(result)
- if __name__ == "__main__":
- input_list = input()
- list_of_string_lists = input_list[1:len(input_list) - 1].split(", ")
- list_of_int_lists = []
- for list_str in list_of_string_lists:
- list_of_int_lists.append(list(map(int, list_str[1:len(list_str) - 1].split(' '))))
- print(process_array(list_of_int_lists))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement