Submission #1411028


Source Code Expand

N, P = map(int, input().split())
A = map(int, input().split())

even = odd = 0

def fact(n):
    if n == 0: return 1
    return n * fact(n-1)

for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

odd_even = 0
for i in range(odd + 1):
    if i % 2 == 0:
        odd_even += fact(odd)/(fact(i)*fact(odd-i))

if P == 0:
    print(int(2**even * odd_even))
else:
    print(int(2**even * (2**odd - odd_even)))

Submission Info

Submission Time
Task A - Biscuits
User raws0705k
Language Python (3.4.3)
Score 200
Code Size 452 Byte
Status AC
Exec Time 19 ms
Memory 3064 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 16
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All sample1.txt, sample2.txt, sample3.txt, sample4.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
Case Name Status Exec Time Memory
in1.txt AC 18 ms 3060 KiB
in2.txt AC 19 ms 3060 KiB
in3.txt AC 18 ms 3064 KiB
in4.txt AC 18 ms 3064 KiB
in5.txt AC 18 ms 3064 KiB
in6.txt AC 18 ms 3064 KiB
in7.txt AC 18 ms 3064 KiB
in8.txt AC 18 ms 3064 KiB
sample1.txt AC 18 ms 3064 KiB
sample2.txt AC 18 ms 3064 KiB
sample3.txt AC 18 ms 3064 KiB
sample4.txt AC 18 ms 3060 KiB