s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s471860815 | p03846 | u315485238 | 1553915905 | Python | Python (3.4.3) | py | Runtime Error | 80 | 14436 | 275 | N=int(input())
A=list(map(int, input().split()))
if N%2:
A = A+ [0]
Adict={}
for a in A:
Adict[a] = Adict.get(a, 0) +1
# 0,0,2,2,4,4 5 (i//2)*2 + 1- N%2 0,2,4
# 1,1,3,3,5,5 6
if all([Adict[i]==2 for i in range(1-N%2, N, 2)]):
print(2**(N//2))
else:
print(0) |
s937313678 | p03846 | u549497563 | 1553460735 | Python | Python (3.4.3) | py | Runtime Error | 121 | 14008 | 436 | n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
mod = 10**9+7
if n%2==0:
k = 0
else:
k = 1
if k==0:
for i in range(1,n,2):
if a[i]!=i or a[i+1]!=i:
print(0)
else:
print(2**(n//2)%mod)
else:
if a[0]!=0:
print(0)
else:
for i in range(2,n,2):
if a[i-1]!=i or a[i]!=i:
print(0)
else:
print(2**(n//2)%mod) |
s346438460 | p03846 | u494871759 | 1553400267 | Python | Python (3.4.3) | py | Runtime Error | 103 | 14004 | 269 | n = int(input())
a = list(map(int,input().split()))
sa = sorted(a)
if n % 2 == 0:
k = 1
l = 0
else:
k = 0
l = 1
a=1000000007
lag = True
for i,s in enumerate(sa):
if ((i+l)//2)*2+k != s:
flag = False
if flag:
print(2**(n//2) % a)
else:
print(0) |
s558055195 | p03846 | u494871759 | 1553398739 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 229 | n = int(intput())
a = list(map(int,input().split()))
sa = sorted(a)
if n % 2 == 0:
k = 0
else:
k = 1
flag = True
for i,s in enumerate(sa):
if (i/2)*2+k != s:
flag = False
if flag:
print(2**n/2)
else:
print(0)
|
s680493875 | p03846 | u494871759 | 1553398696 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 229 | n = int(intput())
a = list(map(int,input().split()))
sa = sorted(a)
if n % 2 == 0:
k = 0
else:
k = 1
flag = True
for i,s in enumerate(sa):
if (i/2)*2+k != s:
flag = false
if flag:
print(2**n/2)
else:
print(0)
|
s683967056 | p03846 | u494871759 | 1553398578 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 231 | n = int(intput())
a = list(map(int,input().split()))
sa = sorted(a)
if n % 2 == 0:
k = 0
else:
k = 1
flag = True
for i,s in enumerate(sa):
if (i//2)*2+k != s:
flag = false
if flag:
print(2**n//2)
else:
print(0)
|
s443245769 | p03846 | u494871759 | 1553398516 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 231 | n = int(intput())
a = list(map(int,input().split()))
sa = sorted(a)
if n % 2 == 0;
k = 0
else;
k = 1
flag = True
for i,s in enumerate(sa);
if (i//2)*2+k != s;
flag = false
if flag;
print(2**n//2)
else;
print(0)
|
s398056838 | p03846 | u384657160 | 1552964156 | Python | Python (3.4.3) | py | Runtime Error | 89 | 14008 | 650 | n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
if n % 2 == 0:
for i in range(1,n+1,2):
if a[i] != i:
print(0)
c = 1
break
else:
if a[i] != a[i-1]:
print(0)
c = 1
break
if c == 0:
print(int(2 ** (n / 2)))
else:
a.insert(0,0)
for i in range(0,n+1,2):
if a[i] != i:
print(0)
c = 1
break
else:
if a[i] != a[i+1]:
print(0)
c = 1
break
if c == 0:
print(int(2 ** ((n-1) / 2))) |
s000382875 | p03846 | u807772568 | 1552743412 | Python | PyPy3 (2.4.0) | py | Runtime Error | 225 | 56044 | 458 | n = int(input())
a = list(map(int,input().split()))
b = [0 for i in range(10**5)]
for i in range(n):
b[a[i]] += 1
if n % 2 == 0:
if sum(b[::2]) == 0 and all(list(map(lambda x:x==2),b[1::2])):
print(2**(n//2))
else:
print(0)
else:
print(b[1:n//2:2],list(map(lambda x:x == 2,b[:n//2:2])))
if sum(b[1::2]) == 0 and all(list(map(lambda x:x == 2,b[::2]))) and b[0] == 1:
print(2**(n//2))
else:
print(0)
|
s819347013 | p03846 | u518064858 | 1551590796 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 580 | a=list(map(int,input().split()))
if n%2==0:
b=sorted(a)
i=0
while i<len(b):
if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
print(0)
exit()
i+=2
print((2**(len(b)//2))%(10**9+7))
else:
b=sorted(a)
if len(b)>1:
if b[1]==0:
print(0)
exit()
if b[0]!=0:
print(0)
exit()
else:
i=1
while i<len(b):
if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
print(0)
exit()
i+=2
print(2**(len(b)//2)%(10**9+7))
|
s931224362 | p03846 | u518064858 | 1551590372 | Python | Python (3.4.3) | py | Runtime Error | 104 | 14008 | 521 | n=int(input())
a=list(map(int,input().split()))
if n%2==0:
b=sorted(a)
i=0
while i<len(b)-2:
if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
print(0)
exit()
i+=2
print((2**(len(b)//2))%(10**9+7))
else:
b=sorted(a)
if b[0]!=0 or b[1]==0:
print(0)
exit()
else:
i=1
while i<len(b)-2:
if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
print(0)
exit()
i+=2
print(2**(len(b)//2)%(10**9+7))
|
s166561908 | p03846 | u518064858 | 1551590135 | Python | Python (3.4.3) | py | Runtime Error | 102 | 14008 | 629 | n=int(input())
a=list(map(int,input().split()))
if n%2==0:
b=sorted(a)
i=0
while i<len(b)-2:
if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
print(0)
exit()
i+=2
if b[-1]!=b[-2]:
print(0)
exit()
print((2**(len(b)//2))%(10**9+7))
else:
b=sorted(a)
if b[0]!=0:
print(0)
exit()
else:
i=1
while i<len(b)-2:
if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
print(0)
exit()
i+=2
if b[-1]!=b[-2]:
print(0)
exit()
print(2**(len(b)//2)%(10**9+7))
|
s549755843 | p03846 | u518064858 | 1551589298 | Python | Python (3.4.3) | py | Runtime Error | 93 | 14008 | 517 | n=int(input())
a=list(map(int,input().split()))
if n%2==0:
b=sorted(a)
i=0
while i<len(b):
if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
print(0)
exit()
i+=2
print((2**(len(b)//2))%(10**9+7))
else:
b=sorted(a)
if b[0]!=0:
print(0)
exit()
else:
i=1
while i<len(b):
if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
print(0)
exit()
i+=2
print(2**(len(b)//2)%(10**9+7))
|
s742952483 | p03846 | u026102659 | 1551587107 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14500 | 550 | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
if a not in nums:
nums[a] = 1
else:
nums[a] += 1
if n % 2 == 1:
if nums[0] != 1:
flag = False
for i in range(n//2):
if nums[2*(i+1)] != 2:
flag = False
break
else:
for i in range(n//2):
if nums[2*i+1] != 2:
flag = False
break
if flag == True:
ans = 2**(n//2)
ans = ans % (10**9 + 7)
print(ans) |
s247353269 | p03846 | u026102659 | 1551587000 | Python | Python (3.4.3) | py | Runtime Error | 76 | 14500 | 546 | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
if a in nums:
nums[a] += 1
else:
nums[a] = 1
if n % 2 == 1:
if nums[0] != 1:
flag = False
for i in range(n//2):
if nums[2*(i+1)] != 2:
flag = False
break
else:
for i in range(n//2):
if nums[2*i+1] != 2:
flag = False
break
if flag == True:
ans = 2**(n//2)
ans = ans % (10**9 + 7)
print(ans) |
s895196779 | p03846 | u026102659 | 1551586797 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14500 | 532 | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
if a in nums:
nums[a] += 1
else:
nums[a] = 1
if n % 2 == 1:
if nums[0] != 1:
flag = False
for i in range(n//2):
if nums[2*(i+1)] != 2:
flag = False
break
else:
for i in range(n//2):
if nums[2*i+1] != 2:
flag = False
break
if flag == True:
ans = 2**(n//2) % (10**9 + 7)
print(ans) |
s078449534 | p03846 | u543954314 | 1551141699 | Python | Python (3.4.3) | py | Runtime Error | 160 | 14436 | 390 | n = int(input())
a = list(map(int, input().split()))
d = {}
s = 1
b = 1
m = 1 - n%2
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
for i in range(n):
if i % 2 == m:
if (i > 0 and d[i] != 2) or (i == 0 and d[i] != 1):
b = 0
break
s *= d[i]
elif i in d:
b = 0
break
if b:
print(s)
else:
print(0) |
s052996393 | p03846 | u543954314 | 1550643875 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 206 | n = int(input())
a = list(map(int, input().split()))
t = [a.count(i) for i in range(n)]
for i in range(n//2):
if t[i*2+n%2] != 0 or t[i*2+1+n%2] != 2: or t[0] > 1:
print(0)
exit()
print(2**(n//2)) |
s328613418 | p03846 | u879870653 | 1549255960 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 329 | N = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)
flg = 1
for i in range(N) :
if i % 2 == 0 :
if L[i] != N-i-1
flg = 0
break
else :
if L[i] != l
flg = 0
break
if flg == 0 :
ans = 0
else :
ans = 2**(N//2) % (10**9+7)
print(ans)
|
s127026264 | p03846 | u879870653 | 1549254377 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14436 | 568 | N = int(input())
A = list(map(int,input().split()))
D = {}
for a in A :
if a not in D :
D[a] = 1
else :
D[a] += 1
for a in D :
if N % 2 == 1 :
if a % 2 != 0 :
ans = 0
break
elif D[a] != 2 :
if a != 0 :
ans = 0
break
else :
ans = 2**(len(D)-1)
else :
if a % 2 == 0 :
ans = 0
break
elif D[a] != 2 :
ans = 0
break
else :
ans = 2**(len(D))
print(ans)
|
s920506558 | p03846 | u239981649 | 1549004575 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 342 | n = int(input())
*a, = map(int, input().split())
a.sort()
if n % 2:
for k in range(n):
if a[k] != (k+1)//2*2:
print(0)
break
else:
print(2**((n-1)//2) % (10**9+7))
else:
for k in range(n):
if a[k] != k//2*2+1:
print(0)
break
else:
print(2**(n//2) % (10**9+7))
|
s511381711 | p03846 | u239981649 | 1549004384 | Python | PyPy3 (2.4.0) | py | Runtime Error | 188 | 38256 | 340 | n = int(input())
*a, = map(int, input().split())
a.sort()
if n % 2:
for k in range(n):
if a[k] != (k+1)//2*2
print(0)
break
else:
print(2**((n-1)//2) % (10**9+7))
else:
for k in range(n):
if a[k] != k//2*2+1
print(0)
break
else:
print(2**(n//2) % (10**9+7))
|
s112956153 | p03846 | u239981649 | 1549004301 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38256 | 332 | n = int(input())
*a, = map(int, input())
a.sort()
if n % 2:
for k in range(n):
if a[k] != (k+1)//2*2
print(0)
break
else:
print(2**((n-1)//2) % (10**9+7))
else:
for k in range(n):
if a[k] != k//2*2+1
print(0)
break
else:
print(2**(n//2) % (10**9+7))
|
s156478553 | p03846 | u644778646 | 1548740002 | Python | Python (3.4.3) | py | Runtime Error | 73 | 15612 | 662 | N = int(input())
A = list(map(int,input().split()))
d = {}
for i in set(A):
d[i] = 0
if N % 2 == 1:
for i in A:
d[i] += 1
for k,v in d.items():
if k == 0:
if v != 1:
print(0)
exit()
continue
if v != 2:
print(0)
exit()
else:
for i in A:
d[i] += 1
for k,v in d.items():
if k == 0:
if v != 0:
print(0)
exit()
if v != 2:
print(0)
exit()
ans = 2
M = 10**9 + 7
if N % 2 == 1:
ans = 2**((N-1)/2) % M
else:
ans = 2**(N/2) % M
print(int(ans))
|
s025359599 | p03846 | u644778646 | 1548739872 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 667 | N = int(input())
A = list(map(int,input().split()))
d = {}
for i in set(A):
d[i] = 0
if N % 2 == 1:
for i in A:
d[i] += 1
for k,v in d.items():
if k == 0:
if v != 1:
print(0)
exit()
continue
if v != 2:
print(0)
exit()
else:
for i in A:
d[i] += 1
for k,v in d.items():
if k == 0:
if v != 0:
print(0)
exit()
if v != 2:
print(0)
exit()
ans = 2
M = 10**9 + 7
if N % 2 == 1:
ans = 2**((N-1)/2) % M
else:
ans = 2**(N/2) % M
print(int(ans))
~
~
|
s685462911 | p03846 | u882209234 | 1548218754 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14244 | 706 | N = int(input())
A = list(map(int, input().split()))
# N が奇数なら、Aはすべて偶数であり、かつ0を除いてすべて1ペア、かつ0が1つあるはず
# N が偶数なら、Aはすべて奇数であり、かつすべて1ペア
# 上記を確認するための辞書
dic = {}
for a in A:
if a in dic.keys():
dic[a] += 1
else: dic[a] = 1
flag = True
ini = N
if N % 2 == 1:
if 0 in A:
if dic[0] == 1:
ini = 2
else:
flag = False
else:
flag = False
else:
ini = 1
for i in range(ini,N,2):
if not flag: break
if dic[i] != 2:
flag = False
if flag:
print(2**(N//2)%(10**9+7))
else:
print(0) |
s829912361 | p03846 | u882209234 | 1548216449 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14436 | 438 | N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
if a in dic.keys():
dic[a] += 1
else: dic[a] = 1
flag = True
ini = N
if N % 2 == 1:
if 0 in A:
if dic[0] == 1:
ini = 2
else:
flag = False
else:
ini = 1
for i in range(ini,N,2):
if not flag: break
if dic[i] != 2:
flag = False
if flag:
print(2**(N//2)%(10**9+7))
else:
print(0) |
s493470973 | p03846 | u882209234 | 1548216132 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14436 | 423 | N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
if a in dic.keys():
dic[a] += 1
else: dic[a] = 1
flag = True
ini = 0
if N % 2 == 1:
if dic[0] == 1:
ini = 2
else:
flag = False
else:
ini = 1
flag = True
for i in range(ini,N,2):
if not flag: break
if dic[i] != 2:
flag = False
if flag:
print(2**(N//2)%(10**9+7))
else:
print(0) |
s332284558 | p03846 | u813098295 | 1547710582 | Python | Python (3.4.3) | py | Runtime Error | 47 | 13960 | 164 | N = int(input())
A = map(int, input().split())
L = [abs((N-1) - 2*i) for i in range(N)]
L.sort(); A.sort()
print(pow(2, (N-N%2)//2, 10**9+7) if L == A else 0) |
s798854631 | p03846 | u813098295 | 1547710513 | Python | Python (3.4.3) | py | Runtime Error | 48 | 13960 | 160 | N = int(input())
A = map(int, input().split())
L = [abs((N-1) - 2*i) for i in range(N)]
L.sort(); A.sort()
print(pow(2, (N-N%2)/2, 10**9+7) if L == A else 0) |
s522309227 | p03846 | u813098295 | 1547710472 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 169 | N = int(raw_input())
A = map(int, raw_input().split())
L = [ abs((N-1) - 2*i) for i in range(N)]
L.sort(); A.sort()
print(pow(2, (N-N%2)/2, 10**9+7) if L == A else 0) |
s871112406 | p03846 | u657818166 | 1547627702 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 379 | import math
n=int(input())
arr=list(map(int,input().split()))
ans=True
if n%2!=0:
zero=0
[zero+=1 for c in arr if c==0]
if zero[0]!=1:
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) |
s590087662 | p03846 | u657818166 | 1547627688 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 376 | import math
n=int(input())
arr=list(map(int,input().split()))
ans=True
if n%2!=0:
zero=0
[zero+=1 for c in arr if c==0]
if zero!=1:
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) |
s723801570 | p03846 | u416773418 | 1547614502 | Python | Python (3.4.3) | py | Runtime Error | 1633 | 13812 | 801 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
else:
if A[0]!=0:
miss=1
A.pop(0)
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s565135682 | p03846 | u416773418 | 1547614302 | Python | Python (3.4.3) | py | Runtime Error | 1626 | 13880 | 690 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if A[0]!=0:
miss=1
A.pop(0)
else:
A.pop(0)
for i in range(int((N-1)/2)):
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s753507282 | p03846 | u416773418 | 1547614147 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 748 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if A[0]!=0:
miss=1
A.pop(0)
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s317480157 | p03846 | u657818166 | 1547614033 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 253 | import math
n=int(input())
arr=list(map(int,input().split()))
ans=True
if n!=0:
if len(set(arr))!=int(n/2)+1
ans=False
else:
if len(set(arr))!=n/2:
ans=False
if ans and n!=0:
print(2**math.floor(n/2)%((10**9)+7))
else:
print(0) |
s953216678 | p03846 | u416773418 | 1547613921 | Python | Python (3.4.3) | py | Runtime Error | 1630 | 13880 | 768 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if A[0]!=0:
miss=1
A.pop(0)
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s209116524 | p03846 | u416773418 | 1547613781 | Python | Python (3.4.3) | py | Runtime Error | 1630 | 13880 | 751 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if A[0]!=0:
miss=1
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s274280959 | p03846 | u657818166 | 1547613615 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14692 | 506 | import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
dic.setdefault(c,0)
dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
for c in range(0,n-1,2):
if c==0 and dic[c]!=1:
ans=False
if dic[c]!=2:
ans=False
break
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans and n!=0:
print(2**math.floor(n/2)%((10**9)+7))
else:
print(0)
|
s346476727 | p03846 | u416773418 | 1547613552 | Python | Python (3.4.3) | py | Runtime Error | 1608 | 13812 | 752 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if not 0 in A:
miss=1
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7))) |
s688496342 | p03846 | u657818166 | 1547613466 | Python | Python (3.4.3) | py | Runtime Error | 76 | 14692 | 489 | import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
dic.setdefault(c,0)
dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
for c in range(2,n-1,2):
if dic[c]!=2:
ans=False
break
if dic[0]!=1:
ans=False
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans and n!=0:
print(2**math.floor(n/2)%((10**9)+7))
else:
print(0)
|
s168387519 | p03846 | u416773418 | 1547613400 | Python | Python (3.4.3) | py | Runtime Error | 1620 | 13812 | 754 | N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
for i in range(int(N/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+1:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int(N/2))%(10e9+7)))
if N%2==1:
if not 0 in A:
miss=1
else:
A.pop(0)
for i in range(int((N-1)/2)):
if miss==1:
break
for j in range(2):
if A[0]==2*i+2:
A.pop(0)
else:
miss=1
break
if miss==1:
print(0)
else:
print(int((2**int((N-1)/2))%(10e9+7)))
|
s994944668 | p03846 | u657818166 | 1547613287 | Python | Python (3.4.3) | py | Runtime Error | 82 | 14692 | 506 | import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
dic.setdefault(c,0)
dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
if dic[0]!=1:
ans=False
print(0)
for c in range(2,n-1,2):
if dic[c]!=2:
ans=False
break
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans and n!=0:
print(2**math.floor(n/2)%((10**9)+7))
else:
print(0)
|
s593599523 | p03846 | u657818166 | 1547613123 | Python | Python (3.4.3) | py | Runtime Error | 84 | 14692 | 497 | import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
dic.setdefault(c,0)
dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
if dic[0]!=1:
ans=False
print(0)
for c in range(2,n-1,2):
if dic[c]!=2:
ans=False
break
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans:
print(2**math.floor(n/2)%((10**9)+7))
else:
print(0)
|
s946275385 | p03846 | u657818166 | 1547612811 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14436 | 481 | n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
dic.setdefault(c,0)
dic[c]+=1
ans=True
print(dic)
#n is odd 5(4 2 0 2 4)
if n%2!=0:
if dic[0]!=1:
ans=False
for c in range(2,n-1,2):
if dic[c]!=2:
ans=False
break
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans:
print(2**int(n/2)%(10**9+7))
else:
print(0)
|
s090884187 | p03846 | u657818166 | 1547612580 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14436 | 425 | n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
dic.setdefault(c,0)
c+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
if dic[0]!=1:
ans=False
for c in range(2,n-1,2):
if dic[c]!=2:
ans=False
break
#n is even 8 (7 5 1 1 7 3 5 3)
else:
for c in range(1,n-1,2):
if dic[c]!=2:
ans=False
if ans:
print(2**int(n/2)/10**9+7)
else:
print(0)
|
s861948459 | p03846 | u491656579 | 1547536831 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 1734 | n = int(input())
a = [int(i) for i in input().split()]
# aの各数値の個数をdictで保持(数値:個数)
a_dict = {}
for v in a:
if v in a_dict:
a_dict[v] += 1
else:
a_dict[v] = 1
# a_dictの中になければならない数値のリストを作成
possible_list = {i: True for i in range(1, n, 2)}
can = True
if n % 2 == 0:
for k, v in a_dict.items():
# 数値が2個でない、もしくはkがpossible_list内に存在しないならFalse
if v != 2 or k not in possible_list:
can = False
break
else:
if a_dict[0] != 1:
can = Falsen = int(input())
a = [int(i) for i in input().split()]
# aの各数値の個数をdictで保持(数値:個数)
a_dict = {}
for v in a:
if v in a_dict:
a_dict[v] += 1
else:
a_dict[v] = 1
# a_dictの中になければならない数値のリストを作成(0以外)
if n % 2 == 0:
possible_list = {i: True for i in range(1, n, 2)}
for k, v in a_dict.items():
# 2個でない、もしくはpossible_list内に存在しない数値ならFalse
if v != 2 or k not in possible_list:
print(0)
exit()
else:
possible_list = {i: True for i in range(0, n, 2)}
if a_dict[0] != 1:
print(0)
exit()
else:
a_dict[0] = 2
for k, v in a_dict.items():
if v != 2 or k not in possible_list:
print(0)
exit()
print(2 ** (n // 2) % (10 ** 9 + 7))
else:
for k, v in a_dict.items():
if v != 2 or k not in possible_list:
can = False
break
if can:
print(2 ** (n // 2) % (10 ** 9 + 7))
else:
print(0) |
s374939335 | p03846 | u491656579 | 1547536250 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 847 | n = int(input())
a = [int(i) for i in input().split()]
# aの各数値の個数をdictで保持(数値:個数)
a_dict = {}
for v in a:
if v in a_dict:
a_dict[v] += 1
else:
a_dict[v] = 1
# a_dictの中になければならない数値のリストを作成
possible_list = {i: True for i in range(1, n, 2)}
can = True
if n % 2 == 0:
for k, v in a_dict.items():
# 数値が2個でない、もしくはkがpossible_list内に存在しないならFalse
if v != 2 or k not in possible_list:
can = False
break
else:
if a_dict[0] != 1:
can = False
else:
for k, v in a_dict.items():
if v != 2 or k not in possible_list:
can = False
break
if can:
print(2 ** (n // 2) % (10 ** 9 + 7))
else:
print(0) |
s689228147 | p03846 | u550943777 | 1546798149 | Python | Python (3.4.3) | py | Runtime Error | 120 | 14420 | 490 | 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 ok== False:
break
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)%(10**9+7))
else:
print(0) |
s405406228 | p03846 | u550943777 | 1546797510 | Python | Python (3.4.3) | py | Runtime Error | 126 | 14420 | 439 | 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) |
s093698214 | p03846 | u445511055 | 1546033695 | Python | Python (3.4.3) | py | Runtime Error | 62 | 14008 | 1340 | # -*- 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(int((2 ** (n // 2)) % (1e9 + 7)))
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(int(2 ** ((n - 1) // 2) % (1e9 + 7)))
else:
print(0)
if __name__ == "__main__":
main()
|
s929690446 | p03846 | u445511055 | 1546033563 | Python | Python (3.4.3) | py | Runtime Error | 64 | 14008 | 1330 | # -*- 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)) % (1e9 + 7))
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) % (1e9 + 7))
else:
print(0)
if __name__ == "__main__":
main()
|
s736385786 | p03846 | u427344224 | 1545603364 | Python | Python (3.4.3) | py | Runtime Error | 49 | 13880 | 267 | 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 * a_set:
print(2 ** ((n-1)//2) % D)
elif zero == 0 and n == 2 * a_set:
print(2 ** (n//2) % D)
else:
print(0) |
s813072978 | p03846 | u513081876 | 1544993502 | Python | Python (3.4.3) | py | Runtime Error | 90 | 13880 | 654 | import sys
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
if N % 2 != 0:
if A[0] == 0:
a = A[1:]
j = 1
k = 0
for i in range(0, N//2 + 1, 2):
if a[k] == a[k+1] == 2*j:
j += 1
k += 2
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7))
else:
print(0)
else:
j = 1
k = 0
for i in range(0, N//2 + 1, 2):
if A[k] == A[k+1] == 2*j -1:
j += 1
k += 2
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7)) |
s958428107 | p03846 | u513081876 | 1544993399 | Python | Python (3.4.3) | py | Runtime Error | 91 | 13880 | 617 | import sys
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
if N % 2 != 0:
if A[0] == 0:
a = A[1:]
j = 1
for i in range(0, N//2 + 1, 2):
if a[i] == a[i+1] == 2*j:
j += 1
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7))
else:
print(0)
else:
j = 1
k = 0
for i in range(0, N//2 + 1, 2):
if A[k] == A[k+1] == 2*j -1:
j += 1
k += 2
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7)) |
s058312725 | p03846 | u513081876 | 1544992955 | Python | Python (3.4.3) | py | Runtime Error | 83 | 13880 | 586 | import sys
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
if N % 2 != 0:
if A[0] == 0:
a = A[1:]
j = 1
for i in range(0, N//2 + 1, 2):
if a[i] == a[i+1] == 2*j:
j += 1
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7))
else:
print(0)
else:
j = 1
for i in range(0, N//2+1, 2):
if A[i] == A[i+i] == 2*j -1:
j += 1
else:
print(0)
sys.exit()
print((2**(N//2)) % (10**9+7)) |
s793287142 | p03846 | u283846680 | 1544154714 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14008 | 273 | 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(n/2)]):
print(2**(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) |
s107559552 | p03846 | u455317716 | 1543520875 | Python | Python (3.4.3) | py | Runtime Error | 45 | 13880 | 308 | N = int(input())
A = [int(x) for x in input().split()]
if not N%2:
result = 2**(N/2)
A.sort()
for i in range(0,N-1,2):
if A[i] != A[i+1]:
result = 0
else:
result = 2**(N/2 - 1)
for i in range(1,N,2):
if A[i] != A[i+1]:
result = 0
print(int(result)) |
s471824913 | p03846 | u657818166 | 1542694764 | Python | Python (3.4.3) | py | Runtime Error | 46 | 14008 | 218 | N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
if N!=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) |
s711076961 | p03846 | u657818166 | 1542694037 | Python | Python (3.4.3) | py | Runtime Error | 45 | 14436 | 182 | N=int(input())
l=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 ans:
print(2**(N//2)%(10**9+7)) |
s522883087 | p03846 | u657818166 | 1542448547 | Python | Python (3.4.3) | py | Runtime Error | 75 | 13812 | 245 | n=int(input())
l=list(map(int,input().split()))
for i,x in enumerate(l.sort()):
if n%2 and x!=int((i+1)/2):
print(0)
else:
if i%2 and i+1!=x:
print(0)
elif i!=x:
print(0)
else:
print(int((n/2)**2)%(10**9+7)) |
s941087143 | p03846 | u657818166 | 1542448277 | Python | Python (3.4.3) | py | Runtime Error | 74 | 13812 | 251 | import math
n=int(input())
l=list(map(int,input().split())).sort()
for i,x in enumerate(l):
if n%2 and x!=int((i+1)/2):
print(0)
else:
if i%2 and i+1!=x:
print(0)
elif i!=x:
print(0)
else:
print(((n/2)**2)%10**9+7) |
s322240497 | p03846 | u620480037 | 1542164982 | Python | Python (3.4.3) | py | Runtime Error | 106 | 17840 | 546 | N=int(input())
if N%2==0:
L=[]
for i in range(int(N/2)):
L.append(i*2+1)
L.append(i*2+1)
else:
L=[0]
for i in range(1,int((N-1)/2)+1):
L.append(i*2)
L.append(i*2)
A=list(map(int,input().split()))
A.sort()
if A==L:
if N%2==0:
ans=1
for j in range(int(N/2)):
ans*=2
ans%=(10**9+7)
print(ans)
else:
ans=1
for j in range(int(N-1)/2):
ans*=2
ans%=(10**9+7)
print(ans)
else:
print(0)
|
s697431900 | p03846 | u620480037 | 1542164771 | Python | Python (3.4.3) | py | Runtime Error | 95 | 17840 | 400 | N=int(input())
if N%2==0:
L=[]
for i in range(int(N/2)):
L.append(i*2+1)
L.append(i*2+1)
else:
L=[0]
for i in range(1,int((N-1)/2)+1):
L.append(i*2)
L.append(i*2)
A=list(map(int,input().split()))
A.sort()
if A==L:
if N%2==0:
print(int(2**(N/2)%(10**9+7)))
else:
print(int(2**((N-1)/2)%(10**9+7)))
else:
print(0)
|
s285210716 | p03846 | u620480037 | 1542164215 | Python | Python (3.4.3) | py | Runtime Error | 97 | 17844 | 380 | N=int(input())
if N%2==0:
L=[]
for i in range(int(N/2)):
L.append(i*2+1)
L.append(i*2+1)
else:
L=[0]
for i in range(1,int((N-1)/2)+1):
L.append(i*2)
L.append(i*2)
A=list(map(int,input().split()))
A.sort()
if A==L:
if N%2==0:
print(int(2**(N/2)))
else:
print(int(2**((N-1)/2)))
else:
print(0)
|
s116769899 | p03846 | u077337864 | 1541264158 | Python | Python (3.4.3) | py | Runtime Error | 25 | 10420 | 378 | N = int(input().strip())
A = map(int, input().strip().split())
if N % 2 == 1:
if A.count(0) != 1:
print(0)
else:
if not all([A.count(i) == 2 for i in range(2, N, 2)]):
print(0)
else:
print(2 ** ((N - 1) // 2) % (10**9 + 7))
else:
if not all([A.count(i) == 2 for i in range(1, N, 2)]):
print(0)
else:
print(2 ** ((N // 2) % (10**9 + 7))) |
s579552432 | p03846 | u026102659 | 1540404579 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 500 | n = int(input())
nums = {0:0}
for i in list(map(int, input().split())):
if i != 0 and (n%2 == i%2):
print(0)
break
if i in nums:
if nums[i] <= 1:
nums[i] += 1
else:
print(0)
break
else:
nums[i] = 1
else:
if n%2 == 1:
if nums[0] == 0:
print(0)
break
del nums[0]
if 1 in list(nums.values()):
print(0)
else:
print(2**len(nums.values()))
|
s189943937 | p03846 | u426108351 | 1539731471 | Python | PyPy3 (2.4.0) | py | Runtime Error | 243 | 55532 | 594 | import collections
N = int(input())
A = list(map(int,input().split()))
A.sort()
A = collections.Counter(A)
ans = 1
count = 0
if N == 1:
if A[0] == 0:
ans = 1
else:
print(0)
if N % 2 == 0:
for i in range(1, int(N/2)+1):
if A[i*2-1] == 2:
count += 1
else:
ans = 0
else:
if A.count(0) == 1:
for i in range(1, int(N/2)+1):
if A[i*2] == 2:
count += 1
else:
ans = 0
else:
ans = 0
for i in range(count):
ans *= 2
ans %= 1000000007
print(ans)
|
s569859586 | p03846 | u702759722 | 1539263839 | Python | Python (3.4.3) | py | Runtime Error | 84 | 10804 | 341 | # -*- coding: utf-8 -*-
# 入力
N = int(input())
A = input().split()
As = sorted(A)
OE = N % 2
if OE == 1:
As.pop(0)
for i in range (0, N, 2):
#print(As)
if As[i] != As[i + 1]:
print(0)
exit()
if As[i] != str(i - 1 + OE):
print(0)
exit()
print(int(pow(2, int((N-OE)/2)) % (pow(10, 9) + 7))) |
s084125404 | p03846 | u853900545 | 1538705338 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 265 | N=int(input())
s=list(map(int,input().split()))
s=list(sorted(s))
if N%2==1:
s.remove(0)
for i in range(n-1)
a = []
for i in range(n//2):
a.append(2*i+1)
if s[0::2]==s[1::2] and s[0::2] ==a :
print((2**((len(s))//2))%(10**9+7))
else:
print(0) |
s037856664 | p03846 | u474270503 | 1537036189 | Python | Python (3.4.3) | py | Runtime Error | 946 | 14008 | 371 | N=int(input())
A=list(map(int, input().split()))
if N%2:
if A.count(0)!=1:
print(0)
exit()
for i in range(2,N,2):
if i not in A:
print(0)
exit()
print((2**((N-1)//2))%(10**9+7))
else:
for i in range(1,N,2):
if i not in 2:
print(0)
exit()
print((2**((N+1)//2))%(10**9+7))
|
s433694022 | p03846 | u102126195 | 1536778815 | Python | Python (3.4.3) | py | Runtime Error | 106 | 14008 | 645 | N = int(input())
A = list(map(int, input().split()))
A.sort()
def main():
if A[0] == N % 2:
print(0)
return 0
if A[0] == 0:
del A[0]
if A[0] == 0:
print(0)
return 0
i = 1
while True:
if i >= len(A):
break
if len(A) % 2 != 0:
print(0)
return 0
if A[i] != A[i - 1]:
print(0)
return 0
i += 2
i = 2
while True:
if i >= len(A):
break
if A[i] == A[i - 1]:
print(0)
return 0
i += 2
print(pow(2, len(A) // 2) % 1000000007)
main() |
s098325448 | p03846 | u787562674 | 1535171232 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 917 | N = int(input())
input_list = sorted([int(i) for i in input().split()])
mod = 10 ** 9 + 7
if N = 1 and input_list[0] == 0:
print(1)
else:
if N % 2 == 1:
if input_list[0] != 0:
print(0)
else:
flag = 2
limit = (N - 1) // 2
for i in range(1, limit, 2):
if input_list[i] == flag and input_list[i+1] == flag:
flag += 2
if i == limit-1:
print((2**limit) % mod)
else:
print(0)
break
elif N % 2 == 0:
flag = 1
limit = N // 2
for i in range(0, limit, 2):
if input_list[i] == flag and input_list[i+1] == flag:
flag += 2
if i == limit-2:
print((2**limit) % mod)
else:
print(0)
break |
s642048790 | p03846 | u787562674 | 1535171176 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 830 | N = int(input())
input_list = sorted([int(i) for i in input().split()])
mod = 10 ** 9 + 7
if N = 1 and input_list[0] == 0:
print(1)
if N % 2 == 1:
if input_list[0] != 0:
print(0)
else:
flag = 2
limit = (N - 1) // 2
for i in range(1, limit, 2):
if input_list[i] == flag and input_list[i+1] == flag:
flag += 2
if i == limit-1:
print((2**limit) % mod)
else:
print(0)
break
elif N % 2 == 0:
flag = 1
limit = N // 2
for i in range(0, limit, 2):
if input_list[i] == flag and input_list[i+1] == flag:
flag += 2
if i == limit-2:
print((2**limit) % mod)
else:
print(0)
break
# 5
# 4 2 0 2 4 |
s851261779 | p03846 | u073775598 | 1535074918 | Python | Python (3.4.3) | py | Runtime Error | 96 | 14008 | 789 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range((N//2+N%2)):
if B[i]!=2:
print(0)
exit()
ans=pow(2,N/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range((N//2+N%2)-1):
if B[i+1]!=2:
print(0)
exit()
ans=pow(2,(N-1)/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
else:
print(0)
|
s772475125 | p03846 | u073775598 | 1535074610 | Python | Python (3.4.3) | py | Runtime Error | 94 | 14008 | 783 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
for i in range(N-1):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
ans=pow(2,N/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
ans=pow(2,(N-1)/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
else:
print(0)
|
s842586755 | p03846 | u073775598 | 1535074396 | Python | Python (3.4.3) | py | Runtime Error | 75 | 14008 | 786 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
for i in range(len(B)):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
ans=pow(2,N/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
ans=pow(2,(N-1)/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
else:
print(0)
|
s602145248 | p03846 | u073775598 | 1535074127 | Python | Python (3.4.3) | py | Runtime Error | 91 | 14008 | 780 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
ans=pow(2,N/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
ans=pow(2,(N-1)/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
else:
print(0) |
s543495248 | p03846 | u073775598 | 1535074081 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 781 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
ans=pow(2,N/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2)
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
ans=pow(2,(N-1)/2)%(pow(10,9)+7)
ans2=int(ans)
print(ans2))
else:
print(0) |
s591386355 | p03846 | u073775598 | 1535073714 | Python | Python (3.4.3) | py | Runtime Error | 94 | 14008 | 715 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N-1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
print(0) |
s173833373 | p03846 | u073775598 | 1535073594 | Python | Python (3.4.3) | py | Runtime Error | 97 | 14008 | 716 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]+1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N+1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
print(0)
|
s137969105 | p03846 | u073775598 | 1535072236 | Python | Python (3.4.3) | py | Runtime Error | 93 | 14008 | 715 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]-1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=(N+1)/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
print(0) |
s727341727 | p03846 | u073775598 | 1535071741 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14008 | 713 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]-1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=N+1/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
print(0) |
s850989046 | p03846 | u073775598 | 1535071710 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 648 | if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]-1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
for i in range(N):
if A[i]%2==0 and A[i]/2<=N+1/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
print(0) |
s699564421 | p03846 | u073775598 | 1535071576 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14008 | 687 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
for i in range(N):
if A[i]%2==1 and (A[i]-1)/2<=N/2:
B[(A[i]-1)//2]+=1
else:
print(0)
exit()
for i in range(len(B)):
if B[i]!=2:
print(0)
exit()
print(int(pow(2,N/2)%(pow(10,9)+7)))
else:
for i in range(N):
if A[i]%2==0 and A[i]/2<=N+1/2:
B[A[i]//2]+=1
else:
print(0)
exit()
if B[0]!=1:
print(0)
exit()
for i in range(len(B)-1):
if B[i+1]!=2:
print(0)
exit()
print(int(pow(2,(N-1)/2)%(pow(10,9)+7))) |
s908875871 | p03846 | u140251125 | 1533779390 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13812 | 1257 | # input
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for i in range(N)]
ans = 1
if N % 2 == 0:
for i in range(N):
if A[i] % 2 == 0:
print(0)
exit()
cnt[A[i]] += 1
if cnt[A[i]] > 2:
print(0)
exit()
if cnt[A[i]] == 1:
ans = (ans * 2) % (10 ** 9 + 7)
print(ans)
else:
for i in range(N):
if A[i] % 2 == 1:
print(0)
exit()
if A[i] > 0:
cnt[A[i]] += 1
if cnt[A[i]] > 2:
print(0)
exit()
if cnt[A[i]] == 1:
ans = (ans * 2) % (10 ** 9 + 7)
if A[i] == 0:
cnt[0] += 1
if cnt[0] > 1:
print(0)
exit()
print(ans)
ans = 1
if N % 2 == 0:
for i in range(1, N, 2):
if A.count(i) > 2:
print(0)
exit()
for i in range(N / 2):
ans = (ans * 2) % (10 ** 9 + 7)
print(ans)
else:
if A.count(0) > 1:
print(0)
exit()
for i in range(2, N, 2):
if A.count(i) > 2:
print(0)
exit()
for i in range(N // 2):
ans = (ans * 2) % (10 ** 9 + 7)
print(ans) |
s902864933 | p03846 | u140251125 | 1533778784 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13880 | 501 | # input
N = int(input())
A = list(map(int, input().split()))
ans = 1
if N % 2 == 0:
for i in range(1, N, 2):
if A.count(i) > 2:
print(0)
exit()
for i in range(N / 2):
ans = (ans * 2) % (10 ^ 9 + 7)
print(ans)
else:
if A.count(0) > 1:
print(0)
exit()
for i in range(2, N, 2):
if A.count(i) > 2:
print(0)
exit()
for i in range(N // 2):
ans = (ans * 2) % (10 ^ 9 + 7)
print(ans) |
s897615983 | p03846 | u140251125 | 1533777640 | Python | Python (3.4.3) | py | Runtime Error | 30 | 10808 | 519 | # input
N = int(input())
A = map(int, input().split())
count = [0 for i in range(N)]
ans = 1
if N % 2 == 0:
for i in range(N):
count[A[i]] += 1
if count [A[i]] > 2:
print(0)
exit()
if A[i] == 0 and count[A[i]] > 1:
print(0)
exit()
ans = (ans * 2) % (10 ^ 9 + 7)
print(ans)
else:
for i in range(N):
if count [A[i]] > 2:
print(0)
exit()
ans = (ans * 2) % (10 ^ 9 + 7)
print(ans)
|
s946672303 | p03846 | u242196904 | 1533443502 | Python | Python (3.4.3) | py | Runtime Error | 439 | 23424 | 683 | # try:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
a = np.array(a)
x = 1e9 + 7
if len(a)%2 == 1:
temp = int((len(a) - 1)/2)
ans = int((2**(temp % 30) + (temp//30) * x) % x)
if sum(a == 0) != 1:
ans = 0
else:
a = a[a!=0]
else:
# ans = 2**(temp)%(1e9 + 7)
temp = int((len(a))/2)
ans = int((2**(temp % 30) + (temp//30) * x) % x)
a = a+1
cands = [2*k for k in range(1,int(len(a)/2) + 1)] * 2
b,bb = np.unique(a,return_counts=True)
if sum(bb == 2) != len(a)/2:
ans = 0
b == np.array(cands)
for bbb, ccc in zip(b,cands):
if bbb != ccc:
ans = 0
break
print(ans)
# except:
# print(0) |
s316762441 | p03846 | u242196904 | 1533442001 | Python | Python (3.4.3) | py | Runtime Error | 178 | 23436 | 421 | import numpy as np
n = int(input())
a = list(map(int,input().split()))
a = np.array(a)
if len(a)%2 == 1:
ans = int(2**((len(a) - 1)/2)%(1e9 + 7))
if sum(a == 0) != 1:
ans = 0
else:
a = a[a!=0]
else:
ans = int(2**((len(a))/2)%(1e9 + 7))
a = a+1
cands = [2*k for k in range(1,int(len(a)/2) + 1)] * 2
for c in cands:
if sum(a == c) != 2:
ans = 0
break
print(ans) |
s025627687 | p03846 | u118605645 | 1532866097 | Python | Python (3.4.3) | py | Runtime Error | 197 | 14008 | 903 | import sys
def is_integer_num(n):
if isinstance(n, int):
return True
if isinstance(n, float):
return n.is_integer()
return False
n = int(input())
a = list(map(int, input().split()))
table = [0] * n
for i in range(n):
s1 = (a[i] + n - 1) / 2
s2 = n - 1 - s1
if not is_integer_num(s1):
print(0)
sys.exit()
x1 = int(s1)
x2 = int(s2)
if x1 != x2:
table[x1] += 1
table[x2] += 1
else:
table[x1] += 1
if (n % 2) == 0:
for i in range(n):
if table[i] != 2:
print(0)
sys.exit()
else:
for i in range(n):
mid = n // 2
if i == mid:
if table[i] != 1:
print(0)
sys.exit()
else:
if table[i] != 2:
print(0)
sys.exit()
ans = int(pow(2, n // 2) % (10e9 + 7))
print(ans) |
s988230586 | p03846 | u588341295 | 1532496615 | Python | Python (3.4.3) | py | Runtime Error | 87 | 13880 | 432 | # -*- coding: utf-8 -*-
N = int(input())
AN = list(map(int, input().split()))
BN = [0] * (N//2+1)
# 偶奇で分けて集計
for i in range(N):
if N % 2 != 0:
BN[N//2 - AN[i]//2] += 1
else:
BN[N//2 - (AN[i]-1)//2] += 1
# 偶数の場合は真ん中を考慮
ans = 0
for i in range(len(BN)):
if BN[i] > 2 or N % 2 != 0 and BN[-1] > 1:
print(0)
exit()
# 結果出力
print(2 ** (N//2)) |
s677366427 | p03846 | u232852711 | 1532301648 | Python | Python (3.4.3) | py | Runtime Error | 98 | 14008 | 558 | MOD = int(10**9+7)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if n%2 == 0:
valid = True
for i in range(n):
if i%2 == 0: v = i+1
else: v = i
if a[i] != v:
valid = False
print(0)
break
if valid:
print(int((2**(n/2))%MOD))
else:
valid = True
for i in range(n):
if i%2 != 0: v = i+1
else: v = i
if a[i] != v:
valid = False
print(0)
break
if valid:
print(int(2**((n-1)/2))%MOD) |
s822530841 | p03846 | u232852711 | 1532300834 | Python | Python (3.4.3) | py | Runtime Error | 89 | 14008 | 428 | MOD = int(10**9+7)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if n%2 == 0:
a_valid = []
for i in range(1, n, 2):
a_valid += [i, i]
if a == a_valid:
print(int((2**(n/2))%MOD))
else:
print(0)
else:
a_valid = [0]
for i in range(2, n, 2):
a_valid += [i, i]
if a == a_valid:
print(int((2**int(n/2))%MOD))
else:
print(0)
|
s585503651 | p03846 | u336325457 | 1530485094 | Python | Python (3.4.3) | py | Runtime Error | 179 | 10420 | 237 | n = int(input())
a = input().split()
d=int(n/2)
for i in range(n):
a[i]=int(a[i])
a.sort()
a.reverse()
j=1
count=2
while(a[j-1]==a[j]):
j+=2
count=count*2
if(j>=n-1):
break
if(count==2**(d)):
print(2**(d))
else:
print(0) |
s987461806 | p03846 | u336325457 | 1530484830 | Python | Python (3.4.3) | py | Runtime Error | 178 | 10420 | 271 | n = int(input())
a = input().split()
d=int(n/2)
for i in range(len(a)):
a[i]=int(a[i])
a.sort()
a.reverse()
j=1
count=2
while(a[j-1]==a[j]):
j+=2
count=count*2
if(n-1==j):
break
elif(n-2==j):
break
if(count==2**(d)):
print(2**(d))
else:
print(0)
|
s715635644 | p03846 | u336325457 | 1530484124 | Python | Python (3.4.3) | py | Runtime Error | 47 | 10612 | 242 | n = int(input())
a = input().split()
d=int(n/2)
for i in a:
i=int(i)
a.reverse()
j=0
count=1
while(a[j]==a[j+1]):
j+=2
count=count*2
if(n-1==j):
break
elif(n-2==j):
break
if(count==2**(d)):
print(2**(d))
else:
print(0)
|
s663390370 | p03846 | u329749432 | 1525546484 | Python | Python (3.4.3) | py | Runtime Error | 91 | 13880 | 356 | n = int(input())
a = sorted([int(i) for i in input().split()])
mod = 10e9+7
if n%2==0:
able = []
for i in range(1,n,2):
able.append(i)
able.append(i)
else:
able = [0]
for i in range(2,n,2):
able.append(i)
able.append(i)
if a == able:
r = n//2
ans = 2**r % mod
print(int(ans))
else:
print(0)
|
s742414711 | p03846 | u444856278 | 1518376164 | Python | Python (3.4.3) | py | Runtime Error | 72 | 14820 | 675 | from collections import Counter
from math import log2
N = int(input())
A = [int(i) for i in input().split()]
po = Counter(A)
ans = -1
mod = 10**9 + 7
if N % 2 == 0:
if po[0] != 0:
ans = 0
else:
for i in range(1,N,2):
if po[i] != 2:
ans = 0
if ans != 0:
while N/2 >= mod:
N -= 2*(mod-1)
ans = int(2**(N/2))
else:
if po[0] != 1:
ans = 0
else:
for i in range(2,N,2):
if po[i] != 2:
ans = 0
if ans != 0:
while (N-1)/2 >= mod:
N -= (2*mod-1)
ans = int(2**((N-1)/2))
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.