This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
from bisect import *
n,m = map(int, input().split())
lis = list(map(int, input().split()))
a = n//2
b = (n-1)//2 + 1
aa = dict()
bb = dict()
#meet in middle prep
for i in range(2**a):
cur = 0
temp = 0
tempi = i
while tempi:
if tempi&1:
temp += lis[cur]
cur +=1
tempi//=2
if temp in aa:
aa[temp] += 1
else:
aa[temp] = 1
for i in range(2**b):
cur = a
temp = 0
tempi = i
while tempi:
if tempi&1:
temp += lis[cur]
cur +=1
tempi//=2
if temp in bb:
bb[temp] += 1
else:
bb[temp] = 1
# | 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... |
# | 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... |