Problem:


Score : 300 points

Problem Statement

There are N people, conveniently numbered 1 through N.
They were standing in a row yesterday, but now they are unsure of the order in which they were standing.
However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.
According to their reports, the difference above for person i is A_i.

Based on these reports, find the number of the possible orders in which they were standing.
Since it can be extremely large, print the answer modulo 10^9+7.
Note that the reports may be incorrect and thus there may be no consistent order.
In such a case, print 0.

Constraints

1≦N≦10^5

0≦A_i≦N-1

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 ... A_N

Output

Print the number of the possible orders in which they were standing, modulo 10^9+7.

Sample Input 1

5
2 4 4 0 2

Sample Output 1

4

There are four possible orders, as follows:

2,1,4,5,3

2,5,4,1,3

3,1,4,5,2

3,5,4,1,2

Sample Input 2

7
6 4 0 2 4 0 2

Sample Output 2

0

Any order would be inconsistent with the reports, thus the answer is 0.

Sample Input 3

8
7 5 1 1 7 3 5 3

Sample Output 3

16



Sample input:
5
2 4 4 0 2


Sample output:
4

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))

dic = {}
for i in range(N):
    if L[i] in dic:
        dic[L[i]] += 1
    else:
        dic[L[i]] = 1
        
res = 1
for d in dic:
    if d != 0:
        if dic[d] != 2:
            res = 0
            break
        else:
            res *= 2
    else:
        if N%2 == 0 and dic[d] != 0:
            res = 0
            break
        elif N%2 == 1 and dic[0] != 1:
            res = 0
            break

if res != 0:
    i = 0
    for _ in range(N+1):
        if N - 2*i - 1 < 0:
            break
        if (N - 2*i - 1 in dic) == False:
            res = 0
            break
        i += 1
        
    for d in dic:
        if d > N - 1:
            res = 0
 
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))

dic = {}
for i in range(N):
    if L[i] in dic:
        dic[L[i]] += 1
    else:
        dic[L[i]] = 1
        
res = 1
for d in dic:
    if d != 0:
        if dic[d] != 2:
            res = 0
            break
        else:
            res *= 2
    else:
        if N%2 == 0 and dic[d] >= 1:
            res = 0
            break
        elif N%2 == 1 and dic[0] != 1:
            res = 0
            break

if res != 0:
    i = 0
    for _ in range(N+1):
        if N - 2*i - 1 < 0:
            break
        if (N - 2*i - 1 in dic) == False:
            res = 0
            break
        i += 1
 
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))

dic = {}
for i in range(N):
    if L[i] in dic:
        dic[L[i]] += 1
    else:
        dic[L[i]] = 1
        
res = 1
for d in dic:
    if d != 0:
        if dic[d] != 2:
            res = 0
            break
        else:
            res *= 2
    else:
        if N%2 == 0 and dic[d] >= 1:
            res = 0
            break
        elif N%2 == 1 and dic[0] != 1:
            res = 0
            break

if res != 0:
    i = 0
    for _ in range(N+1):
        if N - 2*i - 1 < 1:
            break
        if (N - 2*i - 1 in dic) == False:
            res = 0
            break
        i += 1
 
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))

dic = {}
for i in range(N):
    if L[i] in dic:
        dic[L[i]] += 1
    else:
        dic[L[i]] = 1
        
res = 1
for d in dic:
    if d != 0:
        if dic[d] != 2:
            res = 0
            break
        else:
            res *= 2
    else:
        if N%2 == 0 and dic[d] > 1:
            res = 0
            break
        elif N%2 == 1 and dic[0] != 1:
            res = 0
            break
  
if res != 0:
    i = 0
    for _ in range(N+1):
        if N - 2*i - 1 < 1:
            break
        if (N - 2*i - 1 in dic) == False:
            res = 0
            break
        i += 1
 
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))

dic = {}
for i in range(N):
    if L[i] in dic:
        dic[L[i]] += 1
    else:
        dic[L[i]] = 1
        
res = 1
for d in dic:
    if d != 0:
        if dic[d] != 2:
            res = 0
            break
        else:
            res *= 2
    else:
        if N%2 == 0 and dic[d] > 1:
            res = 0
            break
        elif N%2 == 1 and dic[0] != 1:
            res = 0
            break
                
print(res)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
countA= Counter(A)
if n%2==1:
  for k,v in countA.items():
    if k==0:
      if v!=1:
        print(0)
        exit()
    else:
      if v!=2:
        print(0)
        exit()
  print(2**((n-1)//2))
else:
  for k,v in countA.items():
    if v!=2:
      print(0)
      exit()
  print(2**(n//2))

Submission status: Wrong Answer

Solution code:
i=int(input())
a=list(sorted(map(int,input().split())))
if i%2==1:
  b=[0]+[u for u in range(2,i,2) for t in range(2)]
  if a==b:
    print(((i//2)**2)%(10**9+7))
  else:print(0)
else:
  b=[u for u in range(1,i,2) for t in range(2)]
  if a==b:
    print(((i//2)**2)%(10**9+7))
  else:print(0)

Submission status: Wrong Answer

Solution code:
i=int(input())
a=list(sorted(map(int,input().split())))
if i%2==1:
  b=[0]+[u for u in range(2,i,2) for t in range(2)]
  print(a,b)
  if a==b:
    print(((i//2)**2)%(10**9+7))
  else:print(0)
else:
  b=[u for u in range(1,i,2) for t in range(2)]
  print(a,b)
  if a==b:
    print(((i//2)**2)%(10**9+7))
  else:print(0)

Submission status: Wrong Answer

Solution code:
i=int(input())
a=list(sorted(map(int,input().split())))
if i%2==1:
  b=[0]+[u for u in range(2,i,2) for t in range(2)]
  print(a,b)
  if a==b:
    print(2**(i//2))
  else:print(0)
else:
  b=[u for u in range(1,i,2) for t in range(2)]
  print(a,b)
  if a==b:
    print(2**(i//2))
  else:print(0)

Submission status: Wrong Answer

Solution code:
i=int(input())
a=list(sorted(map(int,input().split())))
if i%2==1:
  b=[0]+[u for u in range(2,i,2) for t in range(2)]
  if a==b:
    print((i//2)**2)
  else:print(0)
else:
  b=[u for u in range(1,i,2) for t in range(2)]
  if a==b:
    print((i//2)**2)
  else:print(0)

Submission status: Wrong Answer

Solution code:
a=1000000007
n=int(input())
if n==5:
  exit()
l=list(map(int,input().split()))
l.sort()
if n%2==1:
  if l[0]!=0:
    print(0)
    exit()
  else:
    l.remove(0)
    sh=2
    f=0
    for i in l:
      if f==0:
        if i!=sh:
          print(0)
          exit()
        else:
          f=1
      else:
        if i!=sh:
          print(0)
          exit()
        else:
          sh+=2
          f=0
  sh=(n-1)//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)
else:
  sh=1
  f=0
  for i in l:
    if f==0:
      if i!=sh:
        print(0)
        exit()
      else:
        f=1
    else:
      if i!=sh:
        print(0)
        exit()
      else:
        sh+=2
        f=0
  sh=n//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = pow(2,N//2,mod)
if A.count(0) >= 2:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
A = Counter([int(i) for i in input().split()])

cnt = 0
for k, v in A.items():
    if k == 0 and v == 1:
        pass
    elif k != 0 and v == 2:
        cnt += 1
    else:
        cnt = 0
        break
if cnt == 0:
    print(cnt)
else:
    print(2 ** cnt % (10 ** 9 + 7))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
A = Counter([int(i) for i in input().split()])

cnt = 0
for k, v in A.items():
    if k == 0 and v == 1:
        pass
    elif k != 0 and v == 2:
        cnt += 1
    else:
        cnt = 0
        break
if cnt == 0:
    print(cnt)
else:
    print(2 ** cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

S={}
err=False
for a in A:
  if a in S:
    S[a]+=1
  else:
    S[a]=1
    
for s in S:
  if s!=2:
    err=True
    
if err==True:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        exit()
else:
    if A.count(0) != 0:
        print(0)
        exit()

m = set(A)
for n in m:
    if n == 0:
        continue
    if A.count(n) != 2:
        print(0)
        exit()


ans = 2
M = 10**9 + 7
if 0 in A:
    for i in range(int((N-1)/2) - 1):
        ans *= 2 % M

    #ans = 2**((N-1)/2) % (10**9+7)
else:
    for i in range(int(N/2) - 1):
        ans *= 2 % M
    #ans = 2**(N/2) % (10**9+7)
print(int(ans))

Submission status: Wrong Answer

Solution code:
from collections import Counter

MOD = 10 ** 9 + 7

N = int(input())
a = list(map(int, input().split()))

ans = 2 ** (N // 2)
flg = True
b = Counter(a)
if N % 2 == 1:
    for i in range(0, N, 2):
        if i == 0:
            if b[i] != 1:
                flg = False
                break
        else:
            if b[i] != 2:
                flg = False
                break

else:
    for i in range(1, N, 2):
        if b[i] != 2:
            flg = False
            break

print(ans if flg else 0)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
a = sorted(list(int(i) for i in input().split()))
ct = collections.Counter(a)
odd = []
even = []



if n % 2 == 0:
  for i in range(n//2):
    even.append(i*2+1)
    even.append(i*2+1)
  if a == even:
    print(2**(n//2))
  else:
    print(0)
else:
  odd.append(0)
  for i in range(n//2):
    odd.append(2+i*2)
    odd.append(2+i*2)
  if a == odd:
    print(2**(n//2))
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
A=2**(n//2)%(10**9+7)
for i in range(n):
 if i+(i-n)%2==a[i]:A=0
print(A)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=1
if n%2==0:
  for i in range(n):
    if i%2==0 and i+1!=a[i] or i%2==1 and i!=a[i]:
      f=0
      break
else:
  for i in range(n):
    if i%2==1 and i+1!=a[i] or i%2==0 and i!=a[i]:
      f=0
      break
if f==0:print(0)
else:print(((n//2)**2)%(10**9+7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]

correct = []
if N & 1:
    correct.append(0)
    for i in range(2, N//2 * 2 + 1, 2):
        correct.append(i)
        correct.append(i)
else:
    for i in range(1, N//2 * 2, 2):
        correct.append(i)
        correct.append(i)
if sorted(A) == correct:
    print(2 ** (N//2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True
if n%2!=0:
    if not(0 in arr):
        ans=False
    elif len(set(arr))!=int(n/2)+1:
        ans=False
else:
    if 0 in arr:
        ans=False
    elif len(set(arr))!=int(n/2):
        ans=False

if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))

A.sort()
ans = 1

if len(A)%2==0:
    for i in range(N//2):
        if A[i*2] == A[i*2+1] == i*2+1:
            ans *= 2
        else:
            ans = 0
            break
else:
    for i in range((N-1)//2):
        if A[i*2+1] == A[i*2+2] == (i+1)*2:
            ans *= 2
        else:
            ans = 0
            break
    if A[0]!=0:
        ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))

A.sort()
ans = 1

if len(A)%2==0:
    for i in range(N//2):
        if A[i*2] == A[i*2+1]:
            ans *= 2
        else:
            ans = 0
            break
else:
    for i in range((N-1)//2):
        if A[i*2+1]==A[i*2+2]:
            ans *= 2
        else:
            ans = 0
            break
    if A[0]!=0:
        ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = sorted([int(i) for i in input().split()])
ok = False
b = {}
'''for i in range(N):
    if arr[i] not in b:
        b[arr[i]] = 1
    else:
        b[arr[i]] += 1
if N%2 :
    if b[0] != 1:
        ok = False
    for i in range(1,(N-1)//2+1):
        if b[2*i]!= 2:
            ok = False
else:
    for i in range(1,N//2+1):
        if b[2*i-1] != 2:
            ok = False'''

if ok :
    print(2**(N//2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = sorted([int(i) for i in input().split()])
ok = True
b = {}
'''for i in range(N):
    if arr[i] not in b:
        b[arr[i]] = 1
    else:
        b[arr[i]] += 1
if N%2 :
    if b[0] != 1:
        ok = False
    for i in range(1,(N-1)//2+1):
        if b[2*i]!= 2:
            ok = False
else:
    for i in range(1,N//2+1):
        if b[2*i-1] != 2:
            ok = False'''

if ok :
    print(2**(N//2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = sorted([int(i) for i in input().split()])
ok = True
if N%2==0:
    for i in range(N//2):
        if arr[2*i] != 2*i+1 or arr[2*i+1] != 2*i+1:
            ok = False
else:
    for i in range(1,(N-1)//2):
        if arr[2*i] != 2*i or arr[2*i-1] != 2*i:
            ok = False
if ok :
    print(2**(N//2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = sorted([int(i) for i in input().split()])
ok = True
if N%2==0:
    for i in range(N//2):
        if arr[2*i] != arr[2*i+1]:
            ok = False
else:
    for i in range(1,(N-1)//2):
        if arr[2*i] != arr[2*i-1]:
            ok = False
if ok :
    print(2**(N//2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))

    flag = 1
    if n % 2 == 0:
        check = [0 for _ in range(n // 2)]
        for num in a:
            dum = (num - 1) // 2
            if check[dum] >= 2:
                flag = 0
                break
            else:
                check[dum] += 1

        for num in check:
            if num != 2:
                flag = 0
                break

        if flag == 1:
            temp = 1
            base = 1e9 + 7
            for _ in range(n // 2):
                temp = temp * 2
                if temp >= base:
                    temp = temp % base
            print(temp)
        else:
            print(0)

    else:
        check = [0 for _ in range((n // 2) + 1)]
        for num in a:
            dum = num // 2

            if dum == 0:
                if check[0] >= 1:
                    flag = 0
                    break
                else:
                    check[0] += 1

            else:
                if check[dum] >= 2:
                    flag = 0
                    break
                else:
                    check[dum] += 1

        if check[0] != 1:
            flag = 0
        for num in check[1:]:
            if num != 2:
                flag = 0
                break

        if flag == 1:
            temp = 1
            base = 1e9 + 7
            for _ in range((n - 1) // 2):
                temp = temp * 2
                if temp >= base:
                    temp = temp % base
            print(temp)
        else:
            print(0)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))

    flag = 1
    if n % 2 == 0:
        check = [0 for _ in range(n // 2)]
        for num in a:
            dum = (num - 1) // 2
            if check[dum] >= 2:
                flag = 0
                break
            else:
                check[dum] += 1

        for num in check:
            if num != 2:
                flag = 0
                break

        if flag == 1:
            print(2 ** (n // 2))
        else:
            print(0)

    else:
        check = [0 for _ in range((n // 2) + 1)]
        for num in a:
            dum = num // 2

            if dum == 0:
                if check[0] >= 1:
                    flag = 0
                    break
                else:
                    check[0] += 1

            else:
                if check[dum] >= 2:
                    flag = 0
                    break
                else:
                    check[dum] += 1

        if check[0] != 1:
            flag = 0
        for num in check[1:]:
            if num != 2:
                flag = 0
                break

        if flag == 1:
            print(2 ** ((n - 1) // 2))
        else:
            print(0)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))

    flag = 1
    if n % 2 == 0:
        check = [0 for _ in range(n // 2)]
        for num in a:
            dum = (num - 1) // 2
            if check[dum] >= 2:
                flag = 0
                break
            else:
                check[dum] += 1
        if flag == 1:
            print(2 ** (n // 2))
        else:
            print(0)

    else:
        check = [0 for _ in range((n // 2) + 1)]
        for num in a:
            dum = num // 2

            if dum == 0:
                if check[0] >= 1:
                    flag = 0
                    break
                else:
                    check[0] += 1

            else:
                if check[dum] >= 2:
                    flag = 0
                    break
                else:
                    check[dum] += 1
        if flag == 1:
            print(2 ** ((n - 1) // 2))
        else:
            print(0)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))

    flag = 1
    if n % 2 == 0:
        check = [0 for _ in range(n // 2)]
        for num in a:
            dum = (num - 1) // 2
            if dum == 0:
                if check[0] >= 1:
                    flag = 0
                    break
                else:
                    check[0] += 1
            else:
                if check[dum] >= 2:
                    flag = 0
                    break
                else:
                    check[dum] += 1
        if flag == 1:
            print(2 ** (n // 2))
        else:
            print(0)

    else:
        check = [0 for _ in range((n // 2) + 1)]
        for num in a:
            dum = num // 2

            if dum == 0:
                if check[0] >= 1:
                    flag = 0
                    break
                else:
                    check[0] += 1

            else:
                if check[dum] >= 2:
                    flag = 0
                    break
                else:
                    check[dum] += 1
        if flag == 1:
            print(2 ** ((n - 1) // 2))
        else:
            print(0)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
zero = a_list.count(0)
D = 1000000000 + 7
a_set = set(a_list)
if zero == 1 and n -1 == 2 * len(a_set):
    print(2 ** ((n-1)//2) % D)
elif zero == 0 and n == 2 * len(a_set):
    print(2 ** (n//2) % D)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
zero = a_list.count(0)
D = 1000000000 + 7
if zero >= 2:
    print(0)
elif zero == 1:
    print(2 ** ((n-1)//2) % D)
else:
    print(2 ** (n//2) % D)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
zero = a_list.count(0)

if zero >= 2:
    print(0)
elif zero == 1:
    print(2 ** ((n-1)//2) % 1000000009)
else:
    print(2 ** (n//2) % 1000000009)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = False
if n%2 == 1:
	for i in range(n):
		if a[i] != (i+1)//2*2:
			print("0")
			flag = True
			break
else:
	for i in range(n):
		if a[i] != i//2*2+1:
			print("0")
			flag = True
			break
if flag==False:
	ans = 1
	x = 2
	k = n//2
	p = 1000000007
	for i in range(0, len(bin(k))):
		if (k>>i & 1) == 1:
			ans = ans * x % p
		else:
			x = x * x % p
	print(ans%p)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = False
if n%2 == 1:
	for i in range(n):
		if a[i] != (i+1)//2*2:
			print("0")
			flag = True
			break
else:
	for i in range(n):
		if a[i] != i//2*2+1:
			print("0")
			flag = True
			break
if flag==False:
	ans = 1
	x = 2
	k = n//2
	p = 1000000007
	for i in range(0, len(bin(k))):
		if (k>>i & 1) == 1:
			ans = ans * x % p
		else:
			x = x * x % p
	print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))

if n % 2:
    if a[0] != 0:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a[2*i-1] == a[2*i] and a[2*i-1] == 2*i:
            continue
        else:
            print(0)
            exit()

else:
    for i in range(1, n//2+1):
        if a[2*i-2] == a[2*i-1] and a[2*i-2] == 2*i-1:
            continue
        else:
            print(0)
            exit()

print(2**(n//2))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))

if n % 2:
    if a[0] != 0:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a[2*i-1] != a[2*i]:
            print(0)
            exit()

else:
    for i in range(1, n//2+1):
        if a[2*i-2] != a[2*i-1]:
            print(0)
            exit()

print(2**(n//2))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))

if n % 2:
    if a[0] != 0:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a[2*i-1] != a[2*i]:
            print(0)
            exit()

else:
    for i in range(0, n//2):
        if a[2*i] != a[2*i+1]:
            print(0)
            exit()

print(2**(n//2))

Submission status: Wrong Answer

Solution code:
def pow2(x):
    if x == 0:
        return 1
    elif x % 2 == 0:
        return (pow2(x/2) ** 2) % (10**9 + 7)
    else:
        return 2 * pow2(x-1)

N = int(input())
a_arr = list(map(int, input().split()))
flag = 0

count_arr = []
for _ in range((N+1)//2):
    count_arr.append(0)

if N%2 == 0: # a = N-1, N-3, ... , 1, 3, ...
    for a in a_arr:
        if a%2 == 0:
            flag = 1
            break
        else:
            count_arr[(a-1)//2] += 1
            if count_arr[(a-1)//2] > 2:
                print(0)
                break
else:
    for a in a_arr: # N-1, N-3, ... 0, 2, ..., N-1
        if a%2 == 1:
            flag = 1
            break
        elif a == 0:
            if count_arr[0] > 0:
                flag = 1
                break
            else:
                count_arr[0]
        else:
            if count_arr[a//2] > 1:
                flag = 1
                break
            else:
                count_arr[a//2] += 1
if flag == 1:
    print(0)
else:
    print(pow2(N//2))

Submission status: Wrong Answer

Solution code:
import sys
import collections
import itertools
import math
import re
from collections import deque

# MOD = 10 ** 9 + 7

N = int(input())
A = [int(x) for x in input().split()]
A.sort()

B = []
if N % 2 == 0:
    for i in range(1, N, 2):
        B.append(i)
        B.append(i)
else:
    B.append(0)
    for i in range(2, N, 2):
        B.append(i)
        B.append(i)

if A == B:
    print(2 ** (N // 2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import sys
import collections
import itertools
import math
import re
from collections import deque

# MOD = 10 ** 9 + 7

N = int(input())
A = [int(x) for x in input().split()]
A.sort()

D = {}
for a in A:
    D[a] = D.get(a, 0) + 1

B = []
if N % 2 == 0:
    for i in range(1, N, 2):
        B.append(i)
        B.append(i)
else:
    B.append(0)
    for i in range(2, N, 2):
        B.append(i)
        B.append(i)

if A == B:
    print(2 ** (N // 2))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 0:
  if a == sorted(2*[2*x+1 for x in range(int(n/2))]):
    print(2**int(n/2))
  else:
    print(0)
else:
  if a == sorted(list(2*[2*x for x in range(n//2+1)])[1:]):
    print(2**(n//2))
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
is_odd = N % 2
table = [0]*N
for a in A:
    table[a] += 1
for i in range(N):
    if is_odd and i == 0 and table[i] == 1:
        continue
    if is_odd and i % 2 == 0 and table[i] == 2:
        continue
    if is_odd and i % 2 == 1 and table[i] == 0:
        continue
    if not is_odd and i % 2 == 0 and table[i] == 0:
        continue
    if not is_odd and i % 2 == 1 and table[i] == 2:
        continue
    print(0)
    exit()
print(2**(N//2))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
is_odd = N % 2
table = {}
for a in A:
    if a in table.keys():
        table[a] += 1
    else:
        table[a] = 1
    if a % 2 == is_odd:
        print(0)
        exit()
for k, v in table.items():
    if (k == 0 and v == 1) or (k > 0 and v == 2):
        continue
    print(0)
    exit()
print(2**(N//2))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
is_odd = N % 2
table = {}
for a in A:
    if a in table.keys():
        table[a] += 1
    else:
        table[a] = 1
    if a % 2 == is_odd or table[a] > 1+(a > 0):
        print(0)
        exit()
print(2**(N//2))

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
nOdd=len(l)%2==1
if nOdd:
    num=[x for x in range(len(l)) if n%2==0]
else:
    num=[x for x in range(len(l)) if n%2!=0]
dic={}
for i in num:
    dic[i]=0
for i in l:
    dic.setdefault(i,0)
    dic[i]+=1
for i,c in dic.items():
    if c==0:
        print(0)
        exit()
    

print(pow(2, len(l)//2) % 1000000007)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
nOdd=len(l)%2==1
if nOdd:
    num=[x for x in range(n) if n%2==0]
else:
    num=[x for x in range(n) if n%2!=0]
dic={}
for i in num:
    dic[i]=0
for i in l:
    dic.setdefault(i,0)
    dic[i]+=1
for i,c in dic.items():
    if c==0:
        print(0)
        exit()
    

print(pow(2, n//2) % 1000000007)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if N!=len(set(l))*2:
    a=0
else:
  if l.count(0)!=1 or N!=2*(len(set(l))-1)+1:
      a=0
  else:
    a=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if N!=len(set(l))*2:
    a=0
else:
  if l.count(0)!=1 or N!=2*(len(set(l))-1)+1:
      ans=0
  else:
    ans=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
    if len(l)!=len(set(l))*2:
        a=0
else:
    
    if l.count(0)!=1 or len(l)!=2*len(set(l))+1:
        a=0
    else:
        a=0
if a:
    print((2**(N//2))%(10**9+7))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if len(l)!=len(set(l))*2:
    a=0
else:
  if l.count(0)!=1 or len(l)!=2*len(set(l))+1:
      ans=0
  else:
    ans=0
if a:
   print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if N!=len(set(l))*2:
    a=0
else:
  if l.count(0)!=1:
    l.remove(0)
    if N!=2*len(set(l)):
      ans=0
  else:
    ans=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if N!=len(set(l))*2:
    a=0
else:
  if l.count(0)!=1 or N!=2*len(set(l))+1:
    ans=0
  else:
    ans=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if int(N/2)!=set(l):
    a=0
else:
  if l.count(0)!=1 or N!=2*len(set(l))+1:
    ans=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=1
l.sort()
lis=[]
if n%2==0:
    for x in range(n):
        if x%2==0:
            lis.append(x+1)
        else:
            lis.append(x)
    i=n
    while i>0:
        if l[n-1]!=lis[n-1]:
            s=0
            print(n)
            break
        i-=1
else:
    for x in range(n):
        if x%2!=0:
            lis.append(x+1)
        else:
            lis.append(x)
    i=n
    while i>0:
        if l[n-1]!=lis[n-1]:
            s=0
            print(n)
            break
        i-=1

if s:
    print(2**(int((n/2)))%(((10**9)+7)))
else:
     print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=1
l.sort()
lis=[]
if n%2==0:
    for x in range(n):
        if x%2==0:
            lis.append(x+1)
        else:
            lis.append(x)
    i=n
    while i>0:
        if l[n-1]!=lis[n-1]:
            s=0
            print(n)
            break
        i-=1
else:
    for x in range(n):
        if x%2!=0:
            lis.append(x+1)
        else:
            lis.append(x)
    i=n
    while i>0:
        if l[n-1]!=lis[n-1]:
            s=0
            print(n)
            break
        i-=1

if s:
    print(2**(int((n/2)))%((10**9)+7))
else:
     print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=1
l.sort()
for i,x in enumerate(l):
    if n%2!=0:
        if i%2!=0:
            if i+1!=x:
                s=0
                break
        else:
            if i!=x:
                s=0
                break
    else:
        if i%2==0:
            if i+1!=x:
                s=0
                break
        else:
            if i!=x:
                s=0
                break
        
            
if s:
    print(int((int((n/2))**2)%(10**9+7)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=1
l.sort()
for i,x in enumerate(l):
    if n%2!=0:
        if i%2:
            if i+1!=x:
                s=0
                break
        else:
            if i!=x:
                s=0
                break
    else:
        if i%2==0:
            if i+1!=x:
                s=0
                break
        else:
            if i!=x:
                s=0
                break