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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s352630712 | p03845 | u270343876 | 1482122953 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 167 | N = int(raw_input())
line = raw_input().split(' ')
M = int(raw_input())
for i in range(M):
x = map(int,raw_input().split(' ')
print sum(line)-(line[x[0]]-x[1]) |
s244727028 | p03845 | u158635223 | 1482116039 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 274 | N = int(input())
T = map(int,input().split())
M = int(input())
p = []
x = []
TIME = 0
for i in range(M):
pi,xi = map(int,input().split())
p.append(pi)
x.append(xi)
for n in range(len(T)):
TIME = TIME + T[n]
for i in range(M):
print(TIME - T[p[i]] + x[i]) |
s278170432 | p03845 | u158635223 | 1482114961 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 270 | N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(N)):
sumT += int(T[k])
for i in range(M):
P, X = map(int, input().split())
p.append(P)
x.append(X)
for i in range(len(T)):
print(sumT - int(T[i]) + int(x[i])) |
s855211148 | p03845 | u158635223 | 1482114869 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3192 | 280 | N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(len(N)):
sumT += int(T[k])
for i in range(len(M)):
P, X = map(int, input().split())
p.append(P)
x.append(X)
for i in range(len(T)):
print(sumT - int(T[i]) + int(x[i]))
|
s008751242 | p03846 | u705418271 | 1600832044 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9136 | 312 | n=int(input())
*A=sorted(map(int,input().split()))
a=True
if n%2==0:
for i in range(1,n,2):
if A[i-1]!=i or A[i]!=i:
a=False
break
else:
if A[0]!=0:a=False
else:
for i in range(2,n,2):
if A[i-1]!=i or A[i]!=i:
a=False
break
print(2**(n//2)%(10**9+7) if a else 0)
|
s364198201 | p03846 | u755180064 | 1600059170 | Python | PyPy3 (7.3.0) | py | Runtime Error | 103 | 91576 | 445 | import math
def main():
n = int(input())
As = list(map(int, input().split(' ')))
ind_lis = {}
idx = n - 1
while idx >= 0:
ind_lis[idx] = 0
idx -= 2
for a in As:
ind_lis[a] += 1
if a == 0 and ind_lis[a] > 1:
print(0)
exit()
elif ind_lis[a] > 2:
print(0)
exit()
print(2**(n//2)%(10**9 + 7))
if __name__ == '__main__':
main() |
s117667082 | p03846 | u006880673 | 1599509383 | Python | PyPy3 (7.3.0) | py | Runtime Error | 136 | 102528 | 608 | N = int(input())
A=list(map(int, input().split()))
from collections import Counter
c = dict(Counter(A))
MOD = 10**9 + 7
if N % 2 == 0:
is_ok = 1
cnt = 0
for num in range(1, N, 2):
cnt += 1
if c[num] != 2:
is_ok=0
break
if not is_ok:
print(0)
exit()
print(pow(2, cnt, MOD))
else:
is_ok = 1
cnt = 0
if c[0] != 1:
is_ok = 0
for num in range(2, N, 2):
cnt += 1
if c[num] != 2:
is_ok = 0
break
if not is_ok:
print(0)
exit()
print(pow(2, cnt, MOD)) |
s808121150 | p03846 | u074220993 | 1599179072 | Python | Python (3.8.2) | py | Runtime Error | 92 | 28392 | 441 | N = int(input())
A = [int(x) for x in input().split()]
from collections import defaultdict as dd
Dict = dd(lambda:0)
for a in A:
Dict[a] += 1
if N & 1: Dict[0] += 1
f = (lambda:(lambda x:0 if x&1 else 2) if N&1 else (lambda x:2 if x&1 else 0))()
Possible = {i:f(i) for i in range(N)}
for key,value in Dict.items:
if value != Possible[key]:
print(0)
exit()
else:
print(2**(N//2)%1000000007)
|
s971843740 | p03846 | u696444274 | 1598995606 | Python | PyPy3 (7.3.0) | py | Runtime Error | 158 | 84400 | 930 | n = int(input())
# n, m = list(map(int, input().split()))
# Ch, Cw = list(map(int, input().split()))
# Dh, Dw = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(4)]
# n = int(input())
a = list(map(int, input().split()))
# r = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# data = [list(map(int, input().split())) for i in range(n)]
a.sort()
if n == 1:
if a[0] == 0:
print(1)
else:
print(0)
if n % 2 == 1:
if a[0] == 0 and a[1] == 0:
print(0)
exit()
ans = 1
for i in range(1, n, 2):
if not(a[i] == a[i+1] and a[i] == i+1):
print(0)
exit()
else:
ans *= 2
print(ans)
else:
ans = 1
for i in range(0, n, 2):
if not(a[i] == a[i+1] and a[i] == i+1):
print(0)
exit()
else:
ans *= 2
print(ans)
|
s561753072 | p03846 | u696444274 | 1598995172 | Python | PyPy3 (7.3.0) | py | Runtime Error | 152 | 83416 | 319 | n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] == 0 and a[1] == 0:
print(0)
exit()
count = 1
ans = 1
for i in range(n-1):
if a[i] == a[i+1]:
count += 1
else:
ans *= count
count = 1
if count > 3:
print(0)
exit()
ans *= count
print(ans)
|
s693444911 | p03846 | u909716307 | 1598137599 | Python | Python (3.8.2) | py | Runtime Error | 1937 | 146880 | 361 | n=int(input())
l=list(map(int,input().split()))
mod=10**9+7
if n%2==0:
d={i:2 for i in range(1,n,2)}
else:
d={i:2 for i in range(0,n,2)}
d[0]=1
print('def:',d)
for a in l:
if a in d:
d[a]-=1
else:
print(0)
exit()
print(a,d)
for i in d.values():
if i!=0:
print(0)
exit()
print((2**(n//2))%mod)
|
s345521492 | p03846 | u909716307 | 1598137552 | Python | Python (3.8.2) | py | Runtime Error | 1985 | 146916 | 359 | n=int(input())
l=list(map(int,input().split()))
mod=10**9+7
if n%2==0:
d={i:2 for i in range(1,n,2)}
else:
d={i:2 for i in range(0,n,2)}
d[0]=1
print('def:',d)
for a in l:
if a in d:
d[a]-=1
else:
print(0)
exit()
print(a,d)
for i in d.values():
if i!=0:
print(0)
exit()
print(2**(n//2)%mod)
|
s387827360 | p03846 | u188827677 | 1597579869 | Python | Python (3.8.2) | py | Runtime Error | 81 | 20552 | 495 | n = int(input())
a = sorted(list(map(int, input().split())))
if n%2 == 0:
for i in range(0,n-2,2):
if a[i] != a[i+1] or a[i] == a[i+2]:
print(0)
exit()
if a[-2] != a[-1]:
print(0)
exit()
else:
if a[0] != 0 or a[1] == 0:
print(0)
exit()
for i in range(1,n-2,2):
if a[i] != a[i+1] or a[i] == a[i+2]:
print(0)
exit()
if a[-2] != a[-1]:
print(0)
exit()
mod = 10**9+7
if n%2 == 0: print(2**(n//2)%mod)
else: print(2**((n-1)//2)%mod) |
s168470685 | p03846 | u465101448 | 1595259869 | Python | Python (3.8.2) | py | Runtime Error | 46 | 20540 | 316 | N = int(input())
A = list(map(int,input().split()))
A=check.copy()
A.sort()
check=[0]*N
for idx in range(N%2,N,2):
check[idx]=idx+1
check[idx+1]=idx+1
ans=0
if check == A:
if N % 2 == 0:
ans=(2**(N//2))%(10**9+7)
elif N % 2 != 0:
ans=(2**((N-1)//2))%(10**9+7)
print(ans) |
s843991734 | p03846 | u786020649 | 1594783325 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8984 | 330 | import sys
from collections import deque
p=10**9+7
def main(n,a):
h=n//2
g=n%2
a.sort()
c=[2*(x//2)+g+1 for x in range(n-g)]
if g==1:
c.insert(0,0)
if a!=c:
return 0
return 2**(h%(p-1))
if __name__='__main__':
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))
print(main(n,a))
|
s748181943 | p03846 | u786020649 | 1594782833 | Python | Python (3.8.2) | py | Runtime Error | 87 | 20636 | 426 | import sys
from collections import deque
p=10**9+7
def main(n,a):
h=n//2
g=n%2
if g==1:
if a.count(0)!=1:
del a[a.index(0)]
b=[0]*(n-g)
d=deque(a)
while d:
x=d.pop()
b[x-1-g]=x
b[x-g]=x
c=[2*(x//2)+g+1 for x in range(n-g)]
if g==1:
c.insert(0,0)
if b!=c:
return 0
return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))
print(main(n,a))
|
s891045984 | p03846 | u786020649 | 1594781634 | Python | Python (3.8.2) | py | Runtime Error | 2210 | 179232 | 332 | import sys
p=10**9+7
def main(n,a):
h=n//2
g=n%2
tp=2**h
if g==1:
if a.count(0)!=1:
return 0
else:
del a[a.index(0)]
c=sum([2**((x-1)//2) % tp for x in a])
if c ^ 2*(tp-1):
return 0
return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))
print(main(n,a))
|
s902850639 | p03846 | u788068140 | 1594734751 | Python | Python (3.8.2) | py | Runtime Error | 90 | 20172 | 933 | import math
N = 5
ARR = [2, 4, 4, 0, 2]
N = 7
ARR = [6, 4, 0, 2, 4, 0, 2]
N = 8
ARR = [7, 5, 1, 1, 7, 3, 5, 3]
N = int(input())
ARR = list(map(int, input().split()))
def calculate(n, arr):
if n % 2 == 0:
n = n // 2
start = 1
finalResult = pow(2, n, 1000000000 + 7)
else:
n = n // 2 + 1
start = 0
finalResult = pow(2, (n - 1), 1000000000 + 7)
result = {}
for i in range(n):
index = start + 2 * i
if index == 0:
result.__setitem__(0, 1)
else:
result.__setitem__(index, 2)
isOk = True
for i in range(len(arr)):
aa = result.get(arr[i])
aa = aa - 1
if aa < 0:
isOk = False
break
result.__setitem__(arr[i], aa)
if sum(result.values()) != 0:
isOk = False
if isOk:
print(finalResult)
else:
print(0)
calculate(N, ARR)
|
s557364439 | p03846 | u788068140 | 1594734371 | Python | Python (3.8.2) | py | Runtime Error | 92 | 20756 | 880 | N = 5
ARR = [2, 4, 4, 0, 2]
N = 7
ARR = [6, 4, 0, 2, 4, 0, 2]
N = 8
ARR = [7, 5, 1, 1, 7, 3, 5, 3]
N = int(input())
ARR = list(map(int,input().split()))
def calculate(n, arr):
if n % 2 == 0:
n = n // 2
start = 1
finalResult = 2 ** n
else:
n = n // 2 + 1
start = 0
finalResult = 2 ** (n - 1)
result = {}
for i in range(n):
index = start + 2 * i
if index == 0:
result.__setitem__(0, 1)
else:
result.__setitem__(index, 2)
isOk = True
for i in range(len(arr)):
aa = result.get(arr[i])
aa = aa - 1
if aa < 0:
isOk = False
break
result.__setitem__(arr[i], aa)
if sum(result.values()) != 0:
isOk = False
if isOk:
print(finalResult)
else:
print(0)
calculate(N, ARR)
|
s910577294 | p03846 | u870518235 | 1593987211 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9052 | 323 | N = int(input())
A = list(map(int, input().split()))
ans = 0
A_test = sorted(list(set(A)))
if N % 2 == 1:
judge = [i for i in range(0,N,2)]
if A_test == judge:
ans = 2**(N//2)
else:
judge = [i for i in range(1,N,2)]
if A_test == judge:
ans = 2**(N//2)]
ans = ans % (10**9 + 7)
print(ans)
|
s923036039 | p03846 | u102367647 | 1593908042 | Python | Python (3.8.2) | py | Runtime Error | 181 | 38232 | 1689 | import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007
def main():
n = I()
a_list = LI()
a_dict = list(Counter(a_list).items())
a_dict.sort()
if n % 2 == 0:
for i in range(len(a_dict)):
diff, number = a_dict[i]
if diff % 2 == 0:
ans = 0
break
if diff != 2*i+1 or number != 2:
ans = 0
break
else:
ans = 2**(n/2)%MOD
else:
for i in range(len(a_dict)):
diff, number = a_dict[i]
if diff % 2 == 1 or (diff == 0 and number !=1):
ans = 0
break
if diff != 2*i or (diff > 0 and number != 2):
ans = 0
break
else:
ans = 2**((n-1)/2)%MOD
print(int(ans))
if __name__ == '__main__':
main() |
s561674440 | p03846 | u823458368 | 1593305398 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9080 | 405 | if len(a)%2==1:
tmp = [0]
for i in range((len(a)-1)//2):
tmp.append((i+1)*2)
tmp.append((i+1)*2)
if a == tmp:
ans = (2**((len(a)-1)//2))%(10**9+7)
else:
ans = 0
else:
tmp = []
for i in range(len(a)//2):
tmp.append(2*i+1)
tmp.append(2*i+1)
if a == tmp:
ans = (2**(len(a)//2))%(10**9+7)
else:
ans = 0
print(ans) |
s584936080 | p03846 | u634079249 | 1593290732 | Python | Python (3.8.2) | py | Runtime Error | 74 | 19976 | 1448 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)
MOD = 10 ** 9 + 7
MAX = float('inf')
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = ii()
A = il()
counter = collections.Counter(A)
keys = [False]*(N+1)
keys[(N - 1) % 2] = True
for n in range(1, N//2+1):
keys[((N - 1) % 2)+2*n] = True
if N % 2 != 0 and counter[0] != 1:
print(0)
exit()
cnt = 0
for k, v in counter.items():
if k == 0: continue
if not keys[k] or v != 2:
print(0)
exit()
cnt += 1
print((N // 2) * cnt)
if __name__ == '__main__':
main()
|
s466819548 | p03846 | u634079249 | 1593290710 | Python | Python (3.8.2) | py | Runtime Error | 70 | 20072 | 1444 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)
MOD = 10 ** 9 + 7
MAX = float('inf')
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = ii()
A = il()
counter = collections.Counter(A)
keys = [False]*N
keys[(N - 1) % 2] = True
for n in range(1, N//2+1):
keys[((N - 1) % 2)+2*n] = True
if N % 2 != 0 and counter[0] != 1:
print(0)
exit()
cnt = 0
for k, v in counter.items():
if k == 0: continue
if not keys[k] or v != 2:
print(0)
exit()
cnt += 1
print((N // 2) * cnt)
if __name__ == '__main__':
main()
|
s822113729 | p03846 | u920543723 | 1592275770 | Python | Python (3.4.3) | py | Runtime Error | 186 | 23412 | 421 | import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
n = int(input())
A = iarr()
s = set(A)
if sum(A)==2*sum(s): print(pow(2, l//2, int(1e9+7)))
else: print(0)
|
s176389919 | p03846 | u781262926 | 1591759217 | Python | Python (3.4.3) | py | Runtime Error | 65 | 14436 | 247 | n, *A = map(int, open(0).read().split())
if n % 2:
d = {i:2 for i in range(0, n, 2)}
d[0] -= 1
else:
d = {i:2 for i in range(1, n, 2)}
for a in A:
d[a] -= 1
if any(d.values()):
print(0)
else:
print(pow(2, n//2, 10**9 + 7)) |
s851135548 | p03846 | u999750647 | 1591513644 | Python | Python (3.4.3) | py | Runtime Error | 105 | 21316 | 493 | import collections
n = int(input())
a = list(map(int,input().split()))
b = [0]*(n//2)
c = [0]
d = [0]*(n//2)
e = []
lot = 10**9 + 7
ans = 2**(n//2)%lot
for i in range(n):
b[i] = n-(2*i+1)
if b[i] == 1 or b[i] == 2:
break
for i in range(n):
d[i] = n-(2*i+1)
if d[i] == 1 or b[i] == 2:
break
if n%2 == 0:
e = b + d
else:
e = b + c + d
count1 = collections.Counter(a)
count2 = collections.Counter(e)
if count1 == count2:
print(ans)
else:
print(0) |
s472359022 | p03846 | u999750647 | 1591513446 | Python | Python (3.4.3) | py | Runtime Error | 104 | 21316 | 463 | import collections
n = int(input())
a = list(map(int,input().split()))
b = [0]*(n//2)
c = [0]
d = [0]*(n//2)
e = []
for i in range(n):
b[i] = n-(2*i+1)
if b[i] == 1 or b[i] == 2:
break
for i in range(n):
d[i] = n-(2*i+1)
if d[i] == 1 or b[i] == 2:
break
if n%2 == 0:
e = b + d
else:
e = b + c + d
count1 = collections.Counter(a)
count2 = collections.Counter(e)
if count1 == count2:
print(2**(n//2))
else:
print(0) |
s381537530 | p03846 | u953110527 | 1591128174 | Python | Python (3.4.3) | py | Runtime Error | 93 | 13812 | 720 | n = int(input())
MOD = 10**9+7
a = list(map(int,input().split()))
a.sort()
if n % 2 == 0:
if a[0] != 1 or a[1] != 1 or a[2] == 1:
print(0)
exit()
j = 3
for i in range(2,n,2):
if a[i] != j:
print(0)
exit()
j += 2
j = 3
for i in range(3,n,2):
if a[i] != j:
print(0)
exit()
j+=2
if n % 2 != 0:
if a[0] != 0 or a[1] == 0:
print(0)
exit()
j = 2
for i in range(1,n,2):
if a[i] != j:
print(0)
exit()
j += 2
j = 2
for i in range(2,n,2):
if a[i] != j:
print(0)
exit()
j+=2
print(pow(2,(n//2),MOD)) |
s491327647 | p03846 | u312078744 | 1590896093 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 746 | from collections import Counter
import numpy as np
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 0の個数は、count[0]
num = len(a)
ans = 1
if (num % 2 == 0):
# 偶数パターン
temp = 1
loop = int(num / 2)
for i in range(loop):
tar = count[temp]
if (tar == 2):
ans *= 2
temp += 2
else:
print(0)
exit()
else:
tar0 = count[0]
if (tar0 == 1):
pass
else:
print(0)
exit()
temp = 2
for i in range(num // 2):
if (count[temp] == 2):
ans *= 2
temp += 2
else:
print(0)
exit()
ans % = MOD
print(ans)
|
s214852865 | p03846 | u294721290 | 1590255374 | Python | Python (3.4.3) | py | Runtime Error | 105 | 14008 | 498 | n = int(input())
A = list(map(int,input().split()))
ok = True
if n%2==1:
a=sorted(A)
for i in range(len(a)):
if i%2==0:
if a[i]!=i:
ok = False
else:
if a[i]!=i+1:
ok = False
else:
a=sorted(A)
for i in range(len(a)):
if i%2==1:
if a[i]!=i:
ok = False
else:
if a[i]!=i+1:
ok = False
if ok:
print(2**(n//2))%1000000007
else:
print(0) |
s997456056 | p03846 | u956012380 | 1590028381 | Python | PyPy3 (2.4.0) | py | Runtime Error | 204 | 52780 | 155 | n=int(input())
a=list(map(int,input().split()))
m=int(input())
alls=sum(a)
for _ in range(m):
p,x=map(int,input().split())
print(alls + x - a[p-1]) |
s791736220 | p03846 | u127499732 | 1589480061 | Python | Python (3.4.3) | py | Runtime Error | 57 | 14556 | 388 | def main():
from collections import Counter
n, *a = map(int, open(0).read().split())
c = Counter(a)
f = True
if n % 2 == 0:
f = all(x == 2 for x in c.values())
else:
g = c.pop("0") == 1
f = all(x == 2 for x in c.values()) and g
ans = 2 ** (n // 2) % 1000000007 if f is True else 0
print(ans)
if __name__ == '__main__':
main()
|
s731988600 | p03846 | u127499732 | 1589479947 | Python | Python (3.4.3) | py | Runtime Error | 58 | 14316 | 374 | def main():
import collections
n, *a = map(int, open(0).read().split())
c = collections.Counter(a)
if n % 2 == 0:
f = all(x == 2 for x in c.values())
else:
g = c.pop("0") == 1
f = all(x == 2 for x in c.values()) and g
ans = 2 ** (n // 2) % 1000000007 if f is True else 0
print(ans)
if __name__ == '__main__':
main()
|
s476399984 | p03846 | u131264627 | 1589425090 | Python | Python (3.8.2) | py | Runtime Error | 70 | 20580 | 376 | n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
if n % 2 == 0:
for i in range(0, n, 2):
if aaa[i] != aaa[i + 1]:
print(0)
exit()
print(2 ** (n / 2) % (10 ** 9 + 7))
else:
for i in range(1, n, 2):
if aaa[i] != aaa[i + 1]:
print(0)
exit()
print(2 ** ((n - 1) / 2) % (10 ** 9 + 7)) |
s748383994 | p03846 | u131264627 | 1589424824 | Python | Python (3.8.2) | py | Runtime Error | 58 | 20624 | 396 | n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
ans = int(2 ** (n / 2) % (10 ** 9 + 7)) if n % 2 == 0 else int(2 ** ((n - 1) / 2) % (10 ** 9 + 7))
if n % 2 == 0:
for i in range(0, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
else:
for i in range(1, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
print(ans) |
s319552591 | p03846 | u131264627 | 1589424561 | Python | Python (3.8.2) | py | Runtime Error | 58 | 20640 | 394 | n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
mod = 10 ** 9 + 7
ans = int(2 ** (n / 2) % mod) if n % 2 == 0 else int(2 ** ((n - 1) / 2) % mod)
if n % 2 == 0:
for i in range(0, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
else:
for i in range(1, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
print(ans) |
s798277466 | p03846 | u131264627 | 1589424453 | Python | Python (3.8.2) | py | Runtime Error | 60 | 20592 | 398 | n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
mod = 10 ** 9 + 7
ans = int(2 ** (n / 2) % mod) if n % 2 == 0 else int(2 ** ((n - 1) / 2) % mod)
if n % 2 == 0:
for i in range(0, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
else:
for i in range(1, n - 1, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
print(ans) |
s825987739 | p03846 | u131264627 | 1589423718 | Python | Python (3.8.2) | py | Runtime Error | 56 | 20496 | 399 | n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
mod = 10 ** 9 + 7
ans = int(2 ** (n / 2) % mod) if n % 2 == 0 else int(2 ** ((n - 1) / 2) % mod)
if n % 2 == 0:
for i in range(0, n, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
else:
for i in range(1, n - 1, 2):
if aaa[i] != aaa[i + 1]:
ans = 0
break
print(ans)
|
s134037749 | p03846 | u366369712 | 1589338835 | Python | PyPy3 (2.4.0) | py | Runtime Error | 216 | 55532 | 409 | n = int(input())
alist = list(map(int,input().split()))
dic = {}
mod = 10**9+7
for i in range(n):
if alist[i] not in dic:
dic[alist[i]] = 0
dic[alist[i]] += 1
k = 0
while n-k-1 >= 2:
p = n-k-1
if p == 0:
if dic[p] != 1:
print(0)
exit()
else:
if dic[p] != 2:
print(0)
exit()
k += 2
else:
print(2**(n//2)%mod)
|
s324761421 | p03846 | u366369712 | 1589338744 | Python | PyPy3 (2.4.0) | py | Runtime Error | 231 | 55532 | 390 | n = int(input())
alist = list(map(int,input().split()))
dic = {}
for i in range(n):
if alist[i] not in dic:
dic[alist[i]] = 0
dic[alist[i]] += 1
k = 0
while n-k-1 >= 2:
p = n-k-1
if p == 0:
if dic[p] != 1:
print(0)
exit()
else:
if dic[p] != 2:
print(0)
exit()
k += 2
else:
print(2**(n//2))
|
s147139942 | p03846 | u366369712 | 1589337479 | Python | PyPy3 (2.4.0) | py | Runtime Error | 229 | 55404 | 380 | n = int(input())
alist = list(map(int,input().split()))
dic = {}
for i in range(n):
if alist[i] not in dic:
dic[alist[i]] = 0
dic[alist[i]] += 1
k = -2
while n-1-k >= 2:
k += 2
if n-1-k != 0:
if dic[n-1-k] != 2:
print(0)
exit()
else:
if dic[0] != 1:
print(0)
exit()
p = n//2
print(2**p) |
s146724098 | p03846 | u312078744 | 1589135115 | Python | Python (3.4.3) | py | Runtime Error | 279 | 27684 | 909 | from collections import Counter
import numpy as np
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 1; Counter 同士を比較
# 2; 2step loopで2個であることを確認する。
# > linspace で2個ずつ2ステップのリストを比較して、リストが同じであるかIFチェックする。
# 偶数
if (n % 2 == 0):
check = [0] * n
for i in range(1, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** (n / 2)
else:
ans = 0
# n = 1
elif (n == 1):
if (a[0] == 0):
ans = 1
else:
ans = 0
# 奇数
else:
check = [0] * n
for i in range(2, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** ((n - 1) / 2)
else:
ans = 0
print(int(ans % (10**9 + 7)))
|
s306191249 | p03846 | u312078744 | 1589134746 | Python | Python (3.4.3) | py | Runtime Error | 211 | 27684 | 895 | from collections import Counter
import numpy as np
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 1; Counter 同士を比較
# 2; 2step loopで2個であることを確認する。
# > linspace で2個ずつ2ステップのリストを比較して、リストが同じであるかIFチェックする。
# 偶数
if (n % 2 == 0):
check = [0] * n
for i in range(1, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** (n / 2)
else:
ans = 0
# n = 1
elif (n == 1):
if (a[0] == 0):
ans = 1
else:
ans = 0
# 奇数
else:
check = [0] * n
for i in range(2, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** ((n - 1) / 2)
else:
ans = 0
print(int(ans))
|
s732228931 | p03846 | u312078744 | 1589134260 | Python | Python (3.4.3) | py | Runtime Error | 208 | 27708 | 808 | from collections import Counter
import numpy as np
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 1; Counter 同士を比較
# 2; 2step loopで2個であることを確認する。
# > linspace で2個ずつ2ステップのリストを比較して、リストが同じであるかIFチェックする。
# 偶数
if (n % 2 == 0):
check = [0] * n
for i in range(1, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** (n / 2)
else:
ans = 0
# 奇数
else:
check = [0] * n
for i in range(2, n, 2):
check[i - 1] = i
check[i] = i
checkC = Counter(check)
if (checkC == count):
ans = 2 ** ((n - 1) / 2)
else:
ans = 0
print(int(ans))
|
s366920679 | p03846 | u379142263 | 1589045737 | Python | Python (3.4.3) | py | Runtime Error | 95 | 16840 | 1159 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
n = int(input())
a = list(map(int,input().split()))
if n%2 == 0:
c = collections.Counter(a)
item = []
for key,value in c.items():
item.append([key,value])
item.sort()
ans = 1
for i in range(len(item)):
if 2*i + 1 == item[i][0]:
if item[i][1] == 2:
ans *= 2
ans %=MOD
else:
print(0)
sys.exit()
else:
print(0)
sys.exit()
print(ans%MOD)
else:
c = collections.Counter(a)
ans = 1
item = []
for key,value in c.items():
item.append([key,value])
item.sort()
for i in range(1,len(item)):
if 2*i == item[i][0]:
if item[i][1] == 2:
ans *= 2
ans %=MOD
else:
print(0)
sys.exit()
else:
print(0)
sys.exit()
if item[0][0] == 0 and item[0][1] == 1:
print(ans%MOD)
else:
print(0) |
s262558093 | p03846 | u312078744 | 1588993397 | Python | Python (3.4.3) | py | Runtime Error | 235 | 25152 | 711 | from collections import Counter
import numpy as np
n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
most = count.most_common()
mostA = np.array(most)
num = mostA[:, 1]
# 偶数
if (n % 2 == 0):
check = num - 2
if (np.sum(check) == 0):
ans = 2 ** (n / 2)
else:
ans = 0
# 奇数
else:
num_0 = count[0]
if (num_0 == 1):
mostSort = sorted(most)
mos1 = np.array(mostSort)
mos2 = mos1[1:, 1]
target = mos2
#target = np.array(mostSort[1:])
check = target - 2
if (np.sum(check) == 0):
ans = 2 ** ((n - 1) / 2)
else:
ans = 0
else:
ans = 0
print(int(ans))
|
s336405729 | p03846 | u568789901 | 1588909345 | Python | Python (3.4.3) | py | Runtime Error | 103 | 13880 | 346 | N=int(input())
A=[int(x) for x in input().split()]
A=sorted(A)
if N%2==0:
if all(A[i]==A[i+1] and A[0]==1 and A[i]+2==A[i+2] for i in range(0,N-2,2)):
print(2**(N//2))
else:
print(0)
else:
if all(A[0]==0 and A[i]==A[i+1] and A[i]-2==A[i-1] for i in range(2,N,2)):
print(2**(N//2))
else:
print(0)
|
s410863702 | p03846 | u568789901 | 1588909138 | Python | Python (3.4.3) | py | Runtime Error | 104 | 13880 | 352 | N=int(input())
A=[int(x) for x in input().split()]
A=sorted(A)
if N%2==0:
if all(A[i]==A[i+1] and A[0]==1 and A[i]+2==A[i+2] for i in range(0,N-2,2)):
print(2**(N//2))
else:
print(0)
else:
if all(A[0]==0 and A[i+1]==A[i+2] and A[i+1]+2==A[i+3] for i in range(0,N-2,2)):
print(2**(N//2))
else:
print(0)
|
s044828209 | p03846 | u068595072 | 1588402726 | Python | Python (3.4.3) | py | Runtime Error | 65 | 14820 | 375 | import math
from collections import Counter
mod = 1000000007
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
start = 1
else:
if c[0] != 1:
flag = 0
start = 2
for i in range(start, n, 2):
if c[i] != 2:
flag = 0
break
if flag == 0:
print(0)
else:
print(int(math.pow(2, n // 2)) % mod)
|
s437552769 | p03846 | u068595072 | 1588402554 | Python | Python (3.4.3) | py | Runtime Error | 68 | 14812 | 352 | import math
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
start = 1
else:
if c[0] != 1:
flag = 0
start = 2
for i in range(start, n, 2):
if c[i] != 2:
flag = 0
break
if flag == 0:
print(0)
else:
print(int(math.pow(2, n // 2)))
|
s975600161 | p03846 | u068595072 | 1588402302 | Python | Python (3.4.3) | py | Runtime Error | 67 | 14820 | 362 | import math
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
start = 1
else:
if c[0] < 1:
flag = 0
start = 2
for i in range(start, n, 2):
if c[i] != 2:
flag = 0
break
if flag == 0:
print(0)
exit()
else:
print(int(math.pow(2, n // 2)))
|
s885828826 | p03846 | u106797249 | 1588369036 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 806 | def resolve():
N = int(input())
# A = input().replace(" ", "")
A = list(map(int, readline().rstrip().split()))
import collections
counter = collections.Counter(A)
if N % 2 == 1:
if counter["0"] != 1:
print("0")
return
for k, v in counter.items():
if k == "0":
continue
if int(k) % 2 == 1:
print("0")
return
if v != 2:
print("0")
return
else:
for k, v in counter.items():
if int(k) % 2 == 0:
print("0")
return
if v != 2:
print("0")
return
print( (2**(N//2)) % (10**9+7) )
if '__main__' == __name__:
resolve()
|
s855272054 | p03846 | u870518235 | 1588136989 | Python | Python (3.4.3) | py | Runtime Error | 58 | 14008 | 371 | #Beginner 050 C
N = int(input())
A = list(map(int,input().split()))
L = len(A)
if L % 2 == 0:
lst = [2*i+1 for i in range(L//2)]
if set(lst) == set(A):
print(2**(L//2))
else:
pront(0)
quit()
else:
lst = [2*i for i in range(L//2+1)]
if set(lst) == set(A):
print(2**(L//2+1))
else:
pront(0)
quit()
|
s278131304 | p03846 | u519923151 | 1588044287 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 435 | from collections import Counter
N= int(input())
Alist = list(map(int, input().split()))
count = Counter(Alist)
res = 1
if N % 2 ==0:
for i in range(1,N,2):
if count[i] != 2:
print(0)
exit()
else:
if count[0] != 1:
print(0)
exit()
else:
for i in range(2,N,2):
if count[i] != 2
print(0)
exit()
print(2**(N//2) % (10**9+7)) |
s590974515 | p03846 | u494904817 | 1587857774 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1014 | #include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it
using namespace std;
ll m = 1e9+7;
ll pw(ll a, ll n)
{
ll ans = 1;
while (n > 0)
{
if (n % 2 != 0)
ans = (ans * a) % m;
a = (a * a) % m;
n = n / 2;
}
return ans % m;
}
int main()
{
ll n;
cin >> n;
map<ll, ll> mp;
rep(i, 0, n)
{
ll a;
cin >> a;
mp[a]++;
}
bool y = true;
for (auto x:mp)
{
if (n%2 == 0 && x.second != 2)
y = false;
if (n%2 == 1 && x.second != 2 && x.first != 0)
y = false;
if (n%2 == 1 && x.second != 1 && x.first == 0)
y = false;
}
if (y == false)
cout << 0;
else
cout << pw(n/2, 2) % m;
return 0;
} |
s741471710 | p03846 | u891217808 | 1587253191 | Python | Python (3.4.3) | py | Runtime Error | 69 | 14820 | 427 | from collections import Counter
n = int(input())
ns = list(map(int, input().split()))
rslt = 0
a = 10 ** 9 + 7
cnt = Counter(ns)
if n % 2 == 0:
for i in range(1, n, 2):
if cnt[i] != 2:
print(0)
exit()
rslt = pow(2, n // 2, a)
else:
for i in range(2, n, 2):
if cnt[i] != 2:
print(0)
exit()
if c[0] == 1:
rslt = pow(2, n // 2, a)
print(rslt) |
s327359669 | p03846 | u891217808 | 1587253074 | Python | Python (3.4.3) | py | Runtime Error | 59 | 14900 | 427 | from collections import Counter
n = int(input())
ns = list(map(int, input().split()))
rslt = 0
a = 10 ** 9 + 7
cnt = Counter(ns)
if n % 2 == 0:
for i in range(2, n, 2):
if cnt[i] != 2:
print(0)
exit()
rslt = pow(2, n // 2, a)
else:
for i in range(1, n, 2):
if cnt[i] != 2:
print(0)
exit()
if c[0] == 1:
rslt = pow(2, n // 2, a)
print(rslt) |
s467990082 | p03846 | u852790844 | 1586380500 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 577 | import sys
from collections import deque
mod = 10**9 + 7
n = int(input())
a = deque(sorted(list(map(int, (input().split())))))
if n % 2 == 0:
for i in range(n//2):
b = a.pop()
c = a.pop()
if b == (i+1)*2 and c = (i+1)*2:
print(0)
sys.exit()
print(pow(2, n//2, mod))
if n % 2 == 1:
if a.pop() != 0:
print(0)
sys.exit()
for i in range(n//2):
b = a.pop()
c = a.pop()
if b == (i+1)*2 and c = (i+1)*2:
print(0)
sys.exit()
print(pow(2, n//2, mod))
|
s255419891 | p03846 | u617525345 | 1585358271 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 504 | #include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main() {
ll N; cin>>N;
ll A[N+1] = {};
REP(i,N) {
ll a; cin>>a;
A[a]++;
}
ll ans = 1;
REP(i,N){
if(A[i] > 2) {cout<<0<<endl;return 0;}
if(A[i] == 0) continue;
ans *= A[i];
ans %= MOD;
}
if(A[0] == 2) ans = 0;
cout<<ans<<endl;
return 0;
} |
s049217245 | p03846 | u083960235 | 1584579532 | Python | Python (3.4.3) | py | Runtime Error | 109 | 15956 | 1506 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
# 20:16
N = INT()
A = LIST()
flag = True
# A.sort()
dic = {}
for i in range(N):
if not A[i] in dic:
dic[A[i]] = 1
else:
dic[A[i]] += 1
if N % 2 == 1:
for i in range((N+1) // 2):
if i == 0:
if dic[i] != 1:
flag = False
elif dic[i * 2] != 2:
flag = False
if flag == False:
print(0)
else:
print(2 ** ((N-1) // 2))
else:
for i in range(N // 2):
if dic[2 * i + 1] != 2:
flag = False
if flag == False:
print(0)
else:
print(2 ** (N//2))
# c = Counter(A)
# c = sorted(c.items(), key=lambda x: x[0], reverse = False)
# if c[0][1] != 1:
# print(0)
# for i in c[1:]:
# if c[0]
|
s562590741 | p03846 | u841623074 | 1584038800 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 384 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
p = 10 ** 9 + 7
if N%2==0:
B= sorted([2*i-1 for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,int(N/2))%(10 ** 9 + 7)
else:
ans=0
else:
B= [0]+sorted([2*i for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,int(N/2))%(10 ** 9 + 7)
else:
ans=0
print(int(ans))
|
s880609145 | p03846 | u841623074 | 1584038721 | Python | Python (3.4.3) | py | Runtime Error | 90 | 13880 | 376 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
p = 10 ** 9 + 7
if N%2==0:
B= sorted([2*i-1 for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,N/2))%(10 ** 9 + 7)
else:
ans=0
else:
B= [0]+sorted([2*i for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,N/2))%(10 ** 9 + 7)
else:
ans=0
print(int(ans))
|
s724620537 | p03846 | u841623074 | 1584038470 | Python | Python (3.4.3) | py | Runtime Error | 88 | 13880 | 353 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
B= sorted([2*i-1 for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,N/2))%(10**9+7)
else:
ans=0
else:
B= [0]+sorted([2*i for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans=(pow(2,(N-1)/2))%(10**9+7)
else:
ans=0
print(int(ans)) |
s383406371 | p03846 | u841623074 | 1584038257 | Python | Python (3.4.3) | py | Runtime Error | 89 | 13880 | 398 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
B= sorted([2*i-1 for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans0=pow(2,(N/2))
ans=ans0%(10**9+7)
else:
ans=0
else:
B= [0]+sorted([2*i for i in range(1,N//2+1)]*2)
if sorted(A)==B:
ans0=pow(2,(N-1)/2)
ans=ans0%(10**9+7)
else:
ans=0
print(int(ans))
|
s592728876 | p03846 | u841623074 | 1584037170 | Python | Python (3.4.3) | py | Runtime Error | 95 | 13880 | 468 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
for i in range((N//2)):
B.append(2*i+1)
B.append(2*i+1)
if sorted(A)==B:
ans0=pow(2,(N/2))
ans=ans0%(10**9+7)
else:
ans=0
else:
B.append(0)
for i in range(1,((N-1)//2)+1):
B.append(2*i)
B.append(2*i)
if sorted(A)==B:
ans0=pow(2,(N-1)/2)
ans=ans0%(10**9+7)
else:
ans=0
print(int(ans))
|
s589540269 | p03846 | u841623074 | 1584036736 | Python | Python (3.4.3) | py | Runtime Error | 99 | 13880 | 484 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
for i in range((N//2)):
B.append(2*i+1)
B.append(2*i+1)
if sorted(A)==sorted(B):
ans0=pow(2,(N/2))
ans=ans0%(10**9+7)
else:
ans=0
else:
B.append(0)
for i in range(1,((N-1)//2)+1):
B.append(2*i)
B.append(2*i)
if sorted(A)==sorted(B):
ans0=pow(2,(N-1)/2)
ans=ans0%(10**9+7)
else:
ans=0
print(int(ans))
|
s315110222 | p03846 | u841623074 | 1584036675 | Python | Python (3.4.3) | py | Runtime Error | 99 | 13880 | 479 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
for i in range((N//2)):
B.append(2*i+1)
B.append(2*i+1)
if sorted(A)==sorted(B):
ans0=pow(2,(N/2))
ans=ans0%(10**9+7)
else:
ans=0
else:
B.append(0)
for i in range(1,((N-1)//2)+1):
B.append(2*i)
B.append(2*i)
if sorted(A)==sorted(B):
ans0=pow(2,(N-1)/2)
ans=ans0%(10**9+7)
else:
ans=0
print(ans)
|
s265463058 | p03846 | u841623074 | 1583989483 | Python | Python (3.4.3) | py | Runtime Error | 101 | 13880 | 483 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
for i in range((N//2)):
B.append(2*i+1)
B.append(2*i+1)
if sorted(A)==sorted(B):
ans0=pow(2,(N/2))
ans=ans0%(10**9+7)
else:
ans=0
else:
B.append(0)
for i in range(1,((N-1)//2)+1):
B.append(2*i)
B.append(2*i)
if sorted(A)==sorted(B):
ans0=pow(2,(N-1)/2)
ans=ans0%(10**9+7)
else:
ans=0
print(int(ans))
|
s866255188 | p03846 | u841623074 | 1583989145 | Python | Python (3.4.3) | py | Runtime Error | 99 | 13880 | 450 | N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
for i in range((N//2)):
B.append(2*i+1)
B.append(2*i+1)
if sorted(A)==sorted(B):
ans=(2**(N/2))%(10**9+7)
else:
ans=0
else:
B.append(0)
for i in range(1,((N-1)//2)+1):
B.append(2*i)
B.append(2*i)
if sorted(A)==sorted(B):
ans=(2**((N-1)/2))%(10**9+7)
else:
ans=0
print(int(ans))
|
s276759284 | p03846 | u022871813 | 1583987465 | Python | Python (3.4.3) | py | Runtime Error | 62 | 16624 | 501 | import collections
n = int(input())
A = map(int, input().split())
c = collections.Counter(A)
if n % 2 == 0:
for k, v in c.items():
if v % 2 != 0:
print(0)
break
else:
print(int((2 ** (n / 2)) % (10 ** 9 + 7)))
else:
if c[0] != 1:
print(0)
else:
for k, v in c.items():
if v % 2 != 0 and k != 0:
print(0)
break
else:
print(int((2 ** ((n - 1) / 2)) % (10 ** 9 + 7)))
|
s680809552 | p03846 | u022871813 | 1583987343 | Python | Python (3.4.3) | py | Runtime Error | 66 | 16624 | 480 | import collections
n = int(input())
A = map(int, input().split())
c = collections.Counter(A)
if n % 2 == 0:
for k, v in c.items():
if v % 2 != 0:
break
else:
print(int((2 ** (n / 2)) % (10 ** 9 + 7)))
else:
if c[0] != 1:
print(0)
else:
for k, v in c.items():
if v % 2 != 0 and k != 0:
print(0)
break
else:
print(int((2 ** ((n - 1) / 2)) % (10 ** 9 + 7)))
|
s576173078 | p03846 | u934868410 | 1583945397 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 344 | mod = 10**9 + 7
n = int(input())
a = sorted(list(map(int,input().split())))
if n % 2 == 0:
for i in range(n//2):
if not a[2*i] == a[2*i+1] == 2*i+1:
print(0)
exit()
else:
if a[0] != 0:
print(0)
exit()
for i in range(n//2):
if not a[2*i+1] == a[2*i+2] == 2*i+2
print(0)
exit()
print(pow(2, n//2) % mod) |
s016268442 | p03846 | u038052425 | 1583623112 | Python | Python (3.4.3) | py | Runtime Error | 89 | 14008 | 482 | import sys
N = int(input())
abs_nums = list(map(int, input().split()))
abs_nums.sort()
if N % 2 == 0:
for i in range(0, N, 2):
if abs_nums[i] != i+1 or abs_nums[i+1] != i+1:
print("0")
sys.exit()
else:
if abs_nums[0] != 0:
print("0")
sys.exit()
for i in range(1, N, 2):
if abs_nums[i] != i+1 or abs_nums[i+1] != i+1:
print("0")
sys.exit()
ans = int((2**(N/2)) % ((10**9)+7))
print(ans)
|
s459654457 | p03846 | u038052425 | 1583622917 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 481 | import sys
N = int(input())
abs_nums = list(map(int, input().split()))
abs_nums.sort()
if N % 2 == 0:
for i in range(0, N, 2):
if abs_nums[i] != i+1 or abs_nums[i+1] != i+1:
print("0")
sys.exit()
else:
if abs_nums[0] != 0:
print("0")
sys.exit()
for i in range(1, N, 2):
if abs_nums[i] != i+1 or abs_nums[i+1] != i+1:
print("0")
sys.exit()
print(f"{int((2**(N/2)) % ((10**9)+7))}")
|
s618493902 | p03846 | u396266329 | 1583539495 | Python | Python (3.4.3) | py | Runtime Error | 62 | 14008 | 173 | N=int(input())
A = list(map(int,input().split()))
A = list(set(A))
c = 0
for i in range((N+1)%2, N, 2):
if not A[c] == i:
print(0)
end()
c += 1
print(2**(c-c%2)) |
s764011463 | p03846 | u516447519 | 1583437421 | Python | Python (3.4.3) | py | Runtime Error | 109 | 13880 | 554 | N = int(input())
A = [int(i) for i in input().split()]
A.sort()
c = 0
s = 0
if N % 2 == 1:
if A[0] != 0 or A[1] == 0:
c += 1
for i in range(N-2):
if A[i] + 2 != A[i+2]:
c += 1
if c == 0:
s = (2 ** ((N-1)/2))
print(int(s % 1000000007))
else:
print(0)
else:
if A[0] != 1 or A[1] != 1:
c += 1
for i in range(N-2):
if A[i] + 2 != A[i+2]:
c += 1
if c == 0:
s = (2 ** ((N)/2))
print(int(s % 1000000007))
else:
print(0)
|
s307141399 | p03846 | u219197917 | 1583252307 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14008 | 115 | n=int(input());print([0,pow(2,(n//2),(10**9+7))][sorted(map(int,input().split()))==[i+(i+N+1)%2for i in range(N)]]) |
s681959191 | p03846 | u930705402 | 1582838307 | Python | Python (3.4.3) | py | Runtime Error | 41 | 14008 | 545 | MOD=1000000007
def modpow(a,n,mod):
res=1
a=a%mod
while(n>0):
if(n&1):
res=res*a%mod
a=a*a%mod
n>>=1
return res
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*10001
for i in range(N):
cnt[A[i]]+=1
if(N%2==1):
if(cnt[0]!=1):
print(0)
exit()
for i in range(2,N,2):
if(cnt[i]!=2):
print(0)
exit()
elif(N%2==0):
for i in range(1,N,2):
if(cnt[i]!=2):
print(0)
exit()
print(modpow(2,N//2,MOD)) |
s085146287 | p03846 | u223663729 | 1582837527 | Python | Python (3.4.3) | py | Runtime Error | 59 | 14008 | 719 |
def mod_(b, n, mod):
res = 1
while n > 0:
if n & 1:
res = res * b % mod
b = b * b % mod
n >>= 1
return int(res)
def main():
N = int(input())
A = list(map(int, input().split()))
n = ((N+1) >> 1)
li = [0]*n
for a in A:
if li[a >> 1] >= 2:
print(0)
break
else:
li[a >> 1] += 1
if N & 1:
if li[0] != 1:
print(0)
elif li.count(2) != n-1:
print(0)
else:
c = n-1
print(2 ** c % (1E9+7))
else:
if li.count(2) != n:
print(0)
else:
c = n
print(2 ** c % (1E9+7))
main() |
s814012974 | p03846 | u620157187 | 1582836631 | Python | Python (3.4.3) | py | Runtime Error | 76 | 13880 | 395 | N = int(input())
A = sorted(list(map(int, input().split())))
if len(A)%2 == 0:
result = 2**(len(A)//2)
a = np.arange(1, len(A), 2).tolist()
a = sorted(a+a)
if a == A:
pass
else:
result = 0
else:
result = 2**(len(A)//2)
a = np.arange(2, len(A), 2).tolist()
a = sorted([0]+a+a)
if a == A:
pass
else:
result = 0
print(result) |
s399189564 | p03846 | u223663729 | 1582835110 | Python | Python (3.4.3) | py | Runtime Error | 65 | 14008 | 459 | N = int(input())
A = list(map(int, input().split()))
li = [0]*((N+1) >> 1)
for a in A:
if li[a >> 1] >= 2:
print(0)
break
else:
li[a >> 1] += 1
if N & 1:
if li[0] != 1:
print(0)
elif li.count(1) > 1:
print(0)
else:
c = li.count(2)
print(int(2**c % (10E9 - 7)))
else:
if li.count(1) > 0:
print(0)
else:
c = li.count(2)
print(int(2**c % (10E9 - 7)))
|
s643916877 | p03846 | u022979415 | 1582750145 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14004 | 330 | def main():
people_num = int(input())
information = sorted(list(map(int, input().split())))
unique = len(set(information))
answer = 0
if information[1] > 0 and unique * 2 == people_num + people_num % 2:
answer = (unique - people_num % 2) ** 2
print(answer)
if __name__ == '__main__':
main()
|
s602334086 | p03846 | u516447519 | 1582181576 | Python | Python (3.4.3) | py | Runtime Error | 102 | 13812 | 461 | N = int(input())
A = [int(i) for i in input().split()]
A.sort()
c = 0
s = 0
if N % 2 == 1:
for i in range(1,N-1):
if A[i] == A[i+1]:
c += 1
if c == (N-1)/2:
s = (2 ** ((N-1)/2))
print(int(s % 1000000007))
else:
print(0)
else:
for i in range(N-1):
if A[i] == A[i+1]:
c += 1
if c == (N)/2:
s = (2 ** ((N)/2))
print(int(s % 1000000007))
else:
print(0) |
s868147127 | p03846 | u496687522 | 1581920180 | Python | Python (3.4.3) | py | Runtime Error | 19 | 4724 | 316 | N = int(input())
S = [input() for i in range(N)]
m_count = 0
m_str = []
for i in range(N):
if S.count(S[i]) > m_count:
m_str = [S[i]]
m_count = S.count(S[i])
elif S.count(S[i]) == m_count:
m_str.append(S[i])
m_str = list(set(m_str))
m_str.sort()
print(m_str[i] for i in len(m_str)) |
s311290143 | p03846 | u496687522 | 1581919566 | Python | Python (3.4.3) | py | Runtime Error | 18 | 4724 | 316 | N = int(input())
S = [input() for i in range(N)]
m_count = 0
m_str = []
for i in range(N):
if S.count(S[i]) > m_count:
m_str = [S[i]]
m_count = S.count(S[i])
elif S.count(S[i]) == m_count:
m_str.append(S[i])
m_str = list(set(m_str))
m_str.sort()
print(m_str[i] for i in len(m_str)) |
s654036061 | p03846 | u496687522 | 1581889502 | Python | Python (3.4.3) | py | Runtime Error | 72 | 14008 | 317 | N = int(input())
A = list(map(int, input().split()))
while 0 in A:
A.remove(0)
A_ = list(set(A))
A_.sort()
for i in range(len(A_) - 1):
if A_[i+1] == A_[i]+2:
judge = 1
else:
judge = 0
if len(set(A)) == len(A)/2 and judge:
print((2 ** (len(A) // 2)) % (10**9 +7))
else:
print(0) |
s095511097 | p03846 | u496687522 | 1581888903 | Python | Python (3.4.3) | py | Runtime Error | 72 | 14008 | 302 | N = int(input())
A = list(map(int, input().split()))
while 0 in A:
A.remove(0)
A_ = list(set(A))
A_.sort()
for i in range(len(A_) - 1):
if A_[i+1] == A_[i]+2:
judge = 1
else:
judge = 0
if len(set(A)) == len(A)/2 and judge:
print(2 ** (len(A) // 2))
else:
print(0) |
s307002584 | p03846 | u496687522 | 1581887868 | Python | Python (3.4.3) | py | Runtime Error | 53 | 14008 | 305 | N = int(input())
A = list(map(int, input().split()))
judge = 0
while 0 in A:
A.remove(0)
for i in range(len(set(A))):
if set(A)[i+1] - set(A)[i] == 2:
judge = 1
else:
judge = 0
break
if len(set(A)) == len(A)/2 and judge:
print(2 ** (len(A) // 2))
else:
print(0) |
s135651024 | p03846 | u414458988 | 1581298682 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38416 | 252 | n=int(input())
a=list(map(int,input().split()))
flg = True
if n%2==0:
if 0 in a or len(set(a))!=n//2:
flg=False
else:
if len([0 for i in a if a==0])!=1 or len(set(a))!~n//2+1:
flg=False
if flg:
print(2**(n//2)%(10**9+7))
else:
print(0)
|
s056953847 | p03846 | u414458988 | 1581298604 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 278 | import math
n=int(input())
a=list(map(int,input().split()))
flg = True
if n%2==0:
if 0 in a or len(set(a))!=n//2:
flg=False
else:
if len([0 for i in a if a==0])!=1 or len(set(a))!~n//2+1:
flg=False
if flg:
print(2**(n//2)%(10**9+7))
else:
print(0)
|
s680852220 | p03846 | u857070771 | 1580518298 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 423 | n=int(input())
a=[int(x) for x in input().split()]
a.sort()
even=[]
odd=[]
for i in range(0,n // 2):
even.append(2*i+1)
even=even+even
even.sort()
for j in range(1,(n-1 // 2)+1):
odd.append(2*j)
odd =odd + odd
odd.append(0)
odd.sort()
if n % 2 == 1:
if a == odd:
print(pow(2,n-1 // 2,10**9+7)
else:
print(0)
else:
if a == even:
print(2,n // 2,10**9+7)
else:
print(0)
|
s393196352 | p03846 | u857070771 | 1580501754 | Python | Python (3.4.3) | py | Runtime Error | 89 | 13880 | 355 | N=int(input())
a=[int(x) for x in input().split()]
a.sort()
set_a=list(set(a))
if N % 2 ==0:
for i in range(N):
a[i] != 2*(i // 2) + 1
print(0)
exit(0)
else:
if a[0] != 0:
print(0)
exit(0)
else:
for i in range(1,N):
a[i] != 2(i+1 // 2) +1
print(0)
exit(0)
if N % 2==1:
len=len(set_a)-1
else:
len=len(set(a))
ans=2**len
print(ans) |
s601071908 | p03846 | u857070771 | 1580501506 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 369 | N,x=map(int,input().split())
a=[int(x) for x in input().split()]
a.sort()
set_a=list(set(a))
if N % 2 ==0:
for i in range(N):
a[i] != 2*(i // 2) + 1
print(0)
exit(0)
else:
if a[0] != 0:
print(0)
exit(0)
else:
for i in range(1,N):
a[i] != 2(i+1 // 2) +1
print(0)
exit(0)
if N % 2==1:
len=len(set_a)-1
else:
len=len(set(a))
ans=2**len
print(ans) |
s682689708 | p03846 | u224050758 | 1580358004 | Python | Python (3.4.3) | py | Runtime Error | 80 | 14436 | 529 | N = int(input())
A = [int(n) for n in input().split()]
def main():
d = {}
for a in A:
if a not in d:
d[a] = 0
d[a] += 1
ks = all(map(lambda k: k % 2 == 0, d.keys())) or all(map(lambda k: k % 2 != 0, d.keys()))
if 0 in d:
d[0] += 1
vs = all(map(lambda v: v == 2, d.values()))
if ks and vs:
base = N if len(d) % 2 == 0 else N - 1
ans = int(2 ** (base / 2)) % 1000000007
else:
ans = 0
print(ans)
if __name__ == '__main__':
main() |
s936067543 | p03846 | u224050758 | 1580356260 | Python | Python (3.4.3) | py | Runtime Error | 107 | 13900 | 505 | N = int(input())
A = [int(n) for n in input().split()]
def main():
a = sorted(A)
odd = N % 2 != 0
if odd:
a = list(map(lambda t: t[1] if t[0] % 2 == 0 else t[1] - 1, enumerate(a)))
else:
a = list(map(lambda t: t[1] - 1 if t[0] % 2 == 0 else t[1], enumerate(a)))
passed = a == list(range(N))
if passed:
base = N - 1 if odd else N
ans = int(2 ** (base / 2)) % 1000000007
else:
ans = 0
print(ans)
if __name__ == '__main__':
main() |
s992332830 | p03846 | u159335277 | 1580316880 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 413 | n = int(input())
a = list(map(int, input().split()))
import(sys)
cnt = [0] * n
for x in a:
a[x] += 1
ok = True
for i in range(0, n):
if n % 2 == 1 && i % 2 == 0:
if i == 0 && cnt[i] != 1 or cnt[i] != 2:
ok = False
elif n % 2 == 0 && i % 2 == 0:
if cnt[i] != 2:
ok = False
if not ok:
print(0)
else:
res = 1
for i in range(0, n // 2):
res *= 2
res %= 1000000007
print(res) |
s293511503 | p03846 | u488934106 | 1580230852 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14008 | 288 | import sys
N = int(input())
A = sorted(list(map(int,input().split())))
amari = 10**9 + 7
if N % 2 == 0:
ans = list(int(i) for i in range(1,N,2)*2)
else:
ans = list(int(i) for i in range(0,N,2)*2)
A.insert(0,0)
if ans == A:
print(2**(N//2) % amari)
else:
print("0") |
s144474791 | p03846 | u224050758 | 1579233274 | Python | Python (3.4.3) | py | Runtime Error | 109 | 13900 | 492 | N = int(input())
A = [int(n) for n in input().split()]
def main():
a = sorted(A)
odd = N % 2 != 0
if odd:
a = list(map(lambda t: t[1] if t[0] % 2 == 0 else t[1] - 1, enumerate(a)))
else:
a = list(map(lambda t: t[1] - 1 if t[0] % 2 == 0 else t[1], enumerate(a)))
passed = a == list(range(N))
if passed:
base = N - 1 if odd else N
ans = int(2 ** (base / 2))
else:
ans = 0
print(ans)
if __name__ == '__main__':
main() |
s583545664 | p03846 | u224050758 | 1579063351 | Python | Python (3.4.3) | py | Runtime Error | 97 | 13880 | 413 | N = int(input())
A = [int(n) for n in input().split()]
def main():
a = sorted(A)
even = a[0] == 0
aborted = False
for i in range(N):
correct = (i if even else i + 1) - (0 if i % 2 == 0 else 1)
if a[i] != correct:
aborted = True
break
ans = 0 if aborted else int(2 ** ((N - (1 if even else 0)) / 2))
print(ans)
if __name__ == '__main__':
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.