Submission #877389

#TimeUsernameProblemLanguageResultExecution timeMemory
877389AI_2512Bootfall (IZhO17_bootfall)Cpython 3
0 / 100
1066 ms3096 KiB
def split_array_helper(nums, index, sum1, sum2, arr1, arr2): size = len(nums) if index == size: return sum1 == sum2 arr1.append(nums[index]) if split_array_helper(nums, index + 1, sum1 + nums[index], sum2, arr1, arr2): return True arr1.pop() arr2.append(nums[index]) if split_array_helper(nums, index + 1, sum1, sum2 + nums[index], arr1, arr2): return True arr2.pop() return False def split_array(nums, arr1, arr2): sum1, sum2 = 0, 0 return split_array_helper(nums, 0, sum1, sum2, arr1, arr2) n = int(input()) arr = list(map(int, input().split())) arr2, arr3 = [], [] res = [] total_sum = sum(arr) ruined = False for i in range(1, total_sum + 1): ruined = False size = len(arr) if size > n: arr.pop() arr.append(i) for k in range(n + 1): darr = arr[:] del darr[k] if not split_array(darr, arr2, arr3): ruined = True break arr2.clear() arr3.clear() if not ruined: res.append(i) print(len(res)) if res: print(" ".join(map(str, res)))
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...