This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n = int(input())
a = list(map(int,input().split()))
def rec(b,i):
if i==len(a):
c.append(abs(sum(a)-2*sum(b)))
return
b.append(a[i])
rec(b,i+1)
b.pop()
rec(b,i+1)
c = []
for i in range(n):
rec([],0)
if min(c) != 0:
print(0)
else:
c = []
g = []
for i in range(n):
d = a[i]
a.pop(i)
rec([],0)
a.insert(i,d)
c.sort()
g.append(set(c))
c = []
c = g[0]
for i in g:
c = c.intersection(i)
c = list(c)
c.sort()
print(len(c))
for i in c:
print(i,end=" ")
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |