Problem:


Score : 200 points

Problem Statement

Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.

However, if the result exceeds 10^{18}, print -1 instead.

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

Print the value A_1 \times ... \times A_N as an integer, or -1 if the value exceeds 10^{18}.

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

We have 101 \times 9901 \times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.

Sample Input 3

31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
ans = np.array(list(map(int, input().split()))).prod()

if ans >= 10**18:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
from decimal import *
def resolve():
    N = int(input())
    A = np.array(list(map(Decimal,input().split())))
    ans = Decimal(1)
    if N > 59:
        print(-1)
    elif 0 in A:
        print(0)
    else:
        for i in range(N):
            ans = A[i] * ans
            if ans > 10**18:
                print(-1)
                break
        else:
            print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
import sys

n=int(input())
l=list(map(int,input().split()))

if 0 in l:
	print(21)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)

Submission status: Wrong Answer

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

ans = 1
over = 10**18

for num in nums:
    if ans > over:
        print(-1)
    ans = ans * num

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
li=input().split()
li = [int(i) for i in li] # ここでリストの中の値をint型へ変換しています。
p = np.prod(li)
if p>10**18:
    print(-1)
else:
    print(p)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
b = a[0:n:1]
s = np.prod(b)

if (s > pow(10, 18)):
  print(-1)
else:
  print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
 
num_list = input().split()
 
total = int(1)
if "0" in num_list:
  print(0)
  
else:
  for i in range(N):
    if len(str(total)) >= 19:
      break
    else:
      total *= int(num_list[i])
if len(str(total)) >= 19:
  print(-1)
else:
  print(total)

Submission status: Wrong Answer

Solution code:
N =int(input())
A_n =list(map(int,input().split()))
ans =1
i = 0

while ans <= 10**18 and i < N:
  ans *= A_n[i]
  i +=1
if ans > 10**18:
  print(-1)
elif "0" in A_n is True:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np;
from numba import jit
import warnings
warnings.simplefilter('ignore')

@jit
def slove(ans, A):
    for a in A:
        ans *= a
    return ans



if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    
    ans = slove(1, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a_list = np.array([int(x) for x in input().split()], dtype=np.int64)
ans = np.prod(a_list)
print(ans if ans <= np.int64(10 ** 18) else -1)

Submission status: Wrong Answer

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

if 0 in A_s:
    print(0)
    exit()

res = 1
for A in A_s:
    res *= A
    print(res)
    if res > 10 ** 18:
        res = -1
        break

print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
N = int(input())
a = list(map(int, input().split()))

A = np.array(a)
a_mul = int(np.prod(A))

if (a_mul) > int(10**18):
    print(-1)
else:
    print(a_mul)

Submission status: Wrong Answer

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

bb = 10**18

n = ii()
a = li()
ans = 1

for i in range(len(a)):
    ans *= a[i]
    if ans > bb:
        print(-1)
        break
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import functools
import operator
import numpy as np
b = int(input())
a= np.array([int(x) for x in input().split()])
prod = functools.partial(functools.reduce, operator.mul)

mm = prod(a)

if mm >= 10**18:
    print(-1)
else:
    print(mm)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
result = 1
if 0 in A:
    print(0)
else:
    for x in A:
        result = result*x
    if result >= 10**18:
        print(-1)
    else:
        print(result)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = functools.partial(functools.reduce, operator.mul)

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

x = n(A)
print(x)

if x>1000000000000000000 :
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
nums = list(map(int,input().split()))
ans = np.prod(nums)
if ans <= 10**18:
    print(ans)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
import numpy as np
try:
    N=int(input())
    
    if N>=2 and N<=pow(10,5):
        
        A=input().split(' ')
        counter=0
        for i in A:
            if int(i)>=0 and int(i)<=10**18:
                counter+=1
        
        if counter==len(A):
            
            A_int=list(map(int,A))
        
            
            np_a=np.array(A_int)
            product=np.prod(np_a)
                
            if product>pow(10,18) or product<0 or product==0:
                print(-1)
            else:
                print(product)
        
except Exception as e:
    print(e)

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

n=getN()
a=getList()

import numpy as np
c=np.array(a)
c_=np.prod(c)
if 0 in a:
    print(0)
elif c_<0 or c_>10**18:
    print(-1)
else:
    print(c_)

Submission status: Wrong Answer

Solution code:
import array


n = int(input())
a=[]
a=input().split(" ")
f=0
f1=0
b=0
for i in a:
    if int(i) == 0:
        print("0");
        f1=1
        

sum =1
if f1==0:
    for i in a:
        sum=sum*int(i);
        if sum>1e18:
            f=1
            print("-1");
    
if f==0 and f1==0:
    print(sum)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = sorted([int(v) for v in input().split()], reverse=True)

    over = False
    ans = 1
    for a in A:
        ans *= a
        if ans > 1e18:
            over = True
            break
    
    if over:
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
N=int(input())
A=[*map(str,input().split())]
a=Decimal('1')
while A:
  a=a*Decimal(A.pop())
  if a > Decimal('10')**Decimal('18'):
    print(-1)
    break
else:
  print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
T = int(input())
test_cases = list(map(int,input().split())) 
if np.prod(test_cases) >10 **(18):
    print('-1')
else:
    print(np.prod(test_cases))

Submission status: Wrong Answer

Solution code:
N=int(input())
P=[list(map(int,input().split()))]
import numpy
Q=numpy.array(P)
result =numpy.prod(Q)

if result>10**18:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = input().split()
a = 1
b = 0
for i in range(N):
    b += len(s[i])
if b >19:
    print("-1")
else:
    for i in range(N):
        a *= int(s[i])
        if a <= 10 ** 18:
            print(a)
        else:
            print("-1")

Submission status: Wrong Answer

Solution code:
import numpy as np

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

a = np.insert(1, 1, li)
b = np.prod(a)
c = str(b)
if b > 1000000000000000000:
  print("-1")
else:
  print(c)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)

if 0 in A:
    print('0')
elif A.prod() > 1000000000000000000:
    print('-1')
else:
    print(int(A.prod()))

Submission status: Wrong Answer

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

s = 1
for i in range(N):
    if mlist[i] == 0:
        print(0)
        break
    else:
        s *= mlist[i]

if s >= 10**18:
    print(-1)
elif i == N-1:
    print(s)

Submission status: Wrong Answer

Solution code:
# Nの入力
N = int(input())

# A1,A2,..Anの入力
A = list(map(int,input().split()))

flg = 0         
# A1,A2...Anの積
A_multi = 1
for a in A:
    A_multi = A_multi * a
    A_len = len(str(A_multi))
#    print(A_len)
    if A_len > 19:
        flg = 1
        break
    elif A_len == 19 and A_multi > 10**18:
        flg = 1
        break

if flg == 1:
    print("-1")
else:
    print(A_multi)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
p = np.prod(a)
if p <= 10**18:
  print(p)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
a=list(map(int,input().split()))

x=np.prod(a)
if x>10**18:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import numpy as np
num = int(input())
numList = list(map(int, input().split()))
max = 1000000000000000000
flg = True
result = 1

if 0 in numList:
    print(0)
else:
    npList = np.array(numList)
    result = np.prod(npList, dtype=np.int64)
    if result > max:
        flg = False
    if flg:
        print(result)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
try:
    N=int(input())
    
    if N>=2 and N<=pow(10,5):
        
        A=input().split(' ')
        counter=0
        for i in A:
            if int(i)>=0 and int(i)<=10**18:
                counter+=1
        
        if counter==len(A):
            
            A_int=list(map(int,A))
        
            
            np_a=np.array(A_int)
            product=np.prod(np_a)
                
            if product>pow(10,18) or product<0 or product==0:
                print(-1)
            else:
                print(product)
        else:
            print(-1)
except Exception as e:
    print(e)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
if len(str(ans)) >= 18:
    print ("-1")
else:
    print (ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
list = [int(i) for i in input().split()]
a = np.prod(list)
if a > 10**18:
  print("-1")
else:
  print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = input()
Mul = np.prod(list(map(int, input().split())))
if Mul < 10**18:
  print(Mul)
else:
  print("-1")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = [int(x) for x in input().split()]
res = 1
flag = False
for i in range(n):
    if flag == False:
        res *= arr[i]
    if res == 0:
        print(0)
        exit()
    if res > 10**18:
        flag = True
if res > 10**18:
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

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

from operator import mul
from functools import reduce

nums = A

if reduce(mul, nums) < 10**18:
    print(reduce(mul, nums))

else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int( input() )
A = list( map( int, input().split()))

ret = np.prod( A )
if ret <= 10 ** 18:
  print( ret )
else:
  print( -1 )

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = list(map(int, input().split()))
ans = 1

if nums.count(0) > 0:
  ans = 0
else:
  for i in range(n):
    ans *= nums[i]
    if ans >= 10**18:
      ans = -1
      break
 
print(ans)

Submission status: Wrong Answer

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

ans =1

for i in A:
  ans = i *ans
  if ans > 10**18:
    print(-1)
    break

if ans < 10**18:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
from decimal import Decimal

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

A = np.array(A).astype(np.int64)

ans = int(np.prod(A))

if ans > 10**18:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = input().split()
a = 1
b = 0
for i in range(N):
    b += len(s[i])
if b >18:
    print("-1")
else:
    for i in range(N):
        a *= int(s[i])
        if a <= 10 ** 18:
            print(a)
        else:
            print("-1")

Submission status: Wrong Answer

Solution code:
sute = input()
input_nums = input().split()

output = 1

x = map((lambda x: int(x)), input_nums)

for num in x:
    output *= num   

if output > 10^18:
    output = -1

print(output)

Submission status: Wrong Answer

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

lim = int(10^18)

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= lim*10:
        x = -1
        break

if x > lim:
        x = -1

print(int(x))

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a_list = []

a_list = list(map(int,input().split()))

result = np.prod(a_list)

if result > 10 ** 18:
    print('-1')
else:
    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input().strip())
a = list(map(int, input().strip().split()))
result = 1
LIMIT = 10**18
for i in a:
  result *= i
  if i > LIMIT:
    print(-1)
    sys.exit( )
print(int(result))

Submission status: Wrong Answer

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

def factorization(l):
    arr = dict()
    for j in l:
        temp = j
        for i in range(2, int(-(-j**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                if i in arr.keys():
                    arr[i] += cnt
                else:
                    arr[i] = cnt

        if temp!=1:
            arr[temp] = 1

        if arr==[]:
            arr[j] = 1

    return arr

ans = 1
flag = 0

fac_a = factorization(a)


    
for i in fac_a.keys():
    if i > 10**18 or ans * i**fac_a[i] > 10**18:
        flag = 1
        break
    ans = ans * i**fac_a[i]
    


if flag == 1:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(b,l):
    for a in l:
        b = b * a 
    if b >= 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
l = sorted(l, reverse = True)
sum = l[0]

f = True

a = 0 in l

b = 1000000000000000000

for i in range(1,n):
  if sum > b  and a==False or len(str(l[i]))+len(str(sum)) >=19:
    print(-1)
    f = False
    break
  sum *= l[i]

if f == True:
  print(sum)

Submission status: Wrong Answer

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

if 0 in A:
    print(0)

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

        if ans>10**18:
            print(-1)
    if ans<=10**18:
        print(ans)

Submission status: Wrong Answer

Solution code:
import sys


try:
    sys.stdin = open(sys.path[0] + '/input.txt', 'r')
    sys.stdout = open(sys.path[0] + '/output.txt', 'w')
except FileNotFoundError:
    pass


def solve():
    n = int(input())
    arr = list(map(int, input().split()))
    
    res = 1
    for num in arr:
        res *= num
        if res >= 10 ** 18:
            return -1
    
    return res


print(solve())

Submission status: Wrong Answer

Solution code:
from decimal import *
getcontext().prec = 100
import numpy as np
n = int(input())
a_list = list(map(int,input().split()))
import math
result = 0
check = True
for a in a_list:
  if a == 0:
    check = False
    break
  else:
    result += Decimal(math.log10(a))
if check == False:
  print(0)
elif result > 18:
  print(-1)
else:
  print(int(10**result))

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = [int(x) for x in input().split()] 

mult = 1;

for x in arr:
	mult *= x;

if(mult < 1000000000000000001):
	print(x)
else:
	print("-1")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

n=int(input())
lis=list(map(int, input().split()))
if 0 in lis:
  print(0)
  exit()
elif max(lis)>10**18:
  print(-1)
  exit()
 
def calc(i, h):
  if h>10**18:
    print(-1)
    exit()
  elif i==0:
    return(h)
  return h*calc(i-1, lis[i-1])
result=calc(n, 1)
print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        mark = True
        print(-1)
        break
if 0 in a:
    print(0)
    mark = True
if not mark: print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np 

n = int(input())
A = list(map(int, input().split()))
aa = np.array(A)
sum = np.prod(aa)
if sum > 10**18:
    sum = -1
print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))

a_n = np.array(a,dtype=np.int64)
#print(a_n)
a_n.sort()
tmp = np.prod(a_n[:-1])
tmp *= a_n[-1]
#result = int(np.prod(a_n))
#print(tmp)

if tmp > 10**18:
    print(-1)
else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans = np.prod(a)
 
if ans > 10 ** 18:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
print(math.e)
N = int(input())
A = list(map(int, input().split()))
if N > len(A):
  print(0)
else:
  tmp = 1
  for i in range(N):
    tmp *= A[i]
  if (tmp) - 10**18 > 0:
    print(-1)
  else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
num = int(input())
nums = list(map(int,input().split()))
ans = 1
error = -1
for j in nums:
    ans = ans * j
if(ans >= pow(10,18)):
    print(error)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import operator
from functools import reduce

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

Max = 10 ** 18
result = 1
for i in A:
    if result > Max:
        print(-1)
        exit()
    elif i == 0:
        print(0)
        exit()
    result = result + i
print(result)

Submission status: Wrong Answer

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

ans = 1
flag = 0
for x in range(len(i)):
    ans = ans * i[x]
    if ans > 1000000000000000000:
        flag = 1
        break
    if i[x] == 0:
        flag = 2
        break

if flag == 1:
    print(-1)
elif flag == 2:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+17 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+17 :
        print("-1")
    else :
        print(a)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
p=1
flag=0
for i in range(n):
  p*=l[i]
  if p==10**18:
    flag=1
    break
if flag==0:
  print(p)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
    _ = int(input())
    m = 10 ** 18
    a = np.array(list(map(int, input().split())))
    x = int(np.prod(a))
    print(-1 if m < x else x)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in a:
  i *= i
if len(str(i)) >= 19:
  print(-1)
else:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
 
num_list = input().split()
 
total = int(1)
if 0 in num_list:
  print(0)
  
else:
  for i in range(N):
    if total >= 10**18:
      break
    else:
      total *= int(num_list[i])
if total >= 10**18:
  print("-1")
else:
  print(total)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
x = 0
for num in range(n):
    x *= a[num]
    if x > 10**18:
        print(-1)
        sys.exit()
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())
c = list(map(int, input().split()))
ans=1
max =10**18

if 0 in c:
    ans =0
else:
    for i in range(n):
        if ans< max:
            ans=ans*c[i]
            if ans >= max:
                ans =-1
                break
        else:
            ans = -1
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
b = a[0:n:1]
s = np.prod(b)

if (s > pow(10, 2)):
  print(-1)
else:
  print(s)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

if p < 10**18:
    print(p)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a_list = np.array(list(map(int, input().split())))
y = np.argsort(a_list)
if y[0] == 0:
    print(0)
else:
    ans = 1
    flag = 1
    for i in range(0, n):
        ans *= int(a_list[y[n - 1 - i]])
        if ans > 10 ** 18:
            flag = 0
            break
    if flag == 0:
        print(-1)
    else:
        print(ans)

Submission status: Wrong Answer

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

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= 10**19:
        x = -1
        break

if x > 10**18:
        x = -1
        
print(int(x))

Submission status: Wrong Answer

Solution code:
n=int(input())

a = list(input().split())
a = [int(i) for i in a]
ans=1

if len(a) % 2 == 1: 
  for i in range(1, int(len(a)/2)+2):
    if ans > 10**18 or ans == 0:
      break
    if a[i-1] == 1:
      continue
    if i == int(len(a)/i) + 1:
      ans = ans*a[i-1]
    else:
      ans = ans*a[i-1]*a[-1*i]
    
else:
  for i in range(0, int(len(a)/2)):
    if ans > 10**18 or ans == 0:
      break
    if a[i] == 1:
      continue
    ans = ans*a[i]*a[-1 - i]
    

if ans > 10**18:
  print('-1')
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
mul = 1
numbers = input().split()
for i in range(N):
  mul *= int(numbers[i])
  
print(mul)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input =stdin.readline
a=1;
lst = [] 
n = int(input()) 
lst=list(map(int,input().strip().split()))
  
for i in lst:
    if i==0:
        print("0")
        break
    a*=i;
    if(a>=1000000000000000000):
        break
    
    
if(a>=1000000000000000000):
        print(-1)
else:
    print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
S = input()
S = S.split()
S = np.array([int(i) for i in S])
a = S.prod()
if(a <= np.power(10, 18)):
  print(a)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = 1
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
if B <= 10**18:
    print(B)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
arr = np.array(a)
answer = np.prod(arr)
if answer > 10 ** 18:
    print(-1)
else:
    print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans=np.prod(A)

if ans > 10**18:
	print(-1)
	
else:
	print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from operator import mul
N = input()
A = map(int, input().split())
res = reduce(mul, A)
if res < 10**18:
	print(res)
else:
	print('-1')

Submission status: Wrong Answer

Solution code:
from functools import reduce
import sys
input = sys.stdin.readline

count = int(input())
list = list(map(int, input().split()))
if 0 in list:
    print(0)
else:
    sum = reduce(lambda x, y: x*y, list)

    print(0 in list)


    if sum > 1000000000000000000:
        sum = -1

    print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=list(map(int, input().split()))
a=1
for i in range(N):
  if a>10**18:
    break
  a*=s[i]
print(-1 if a>10**18 else a)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
N=int(input())
A=[*map(str,input().split())]
a=Decimal('1')
while A:
  a=a*Decimal(A.pop())
  if a > 10**18:
    break

if a > 10**18:
  print(-1)
else:
  print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
result = 1
if 0 in A:
    print(0)
for x in A:
    result = result*x
if result >= 1000000000000000000:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
sute = input()
input_nums = input().split()

output = 1

x = map((lambda x: int(x)), input_nums)

for num in x:
    output *= num
    if output > 10^18:
      output = -1
      break   
    
print(output)

Submission status: Wrong Answer

Solution code:
N = int(input())
num = list(map(int, input().split()))
answer = 1
for i in range(N):
  if answer*num[i] <= 10**18:
    answer = answer*num[i]
    if i == N-1:
      print(answer)
  else:
    print(-1)
    break

Submission status: Wrong Answer

Solution code:
import numpy as np
try:
    N=int(input())
    
    if N>=2 and N<=pow(10,5):
        
        A=input().split(' ')
        
        A_int=list(map(int,A))
            
        np_a=np.array(A_int)
        product=np.prod(np_a)
            
        if product>pow(10,18) or product<0 or product==0:
            print(-1)
        else:
            print(product)
except Exception as e:
    print(e)

Submission status: Wrong Answer

Solution code:
n = int(input())

aList = list(map(int, input().split()))

result = aList[0]

for i in range(n):
  if i == 0:
    continue
  result = result * aList[i]

enemy = 10 ** 18

if result < enemy:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np


n=int(input())
li=input().split()
li = [int(i) for i in li] # ここでリストの中の値をint型へ変換しています。
p = np.prod(li)
if p>10**18:
    print(-1)
else:
    print(p)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
checker =False
for j in a:
  if j > 1000000000000000000:
    result = -1
    checker =True
if 0 in a:
  result = 0
  checker=True
import numpy as np
while checker==False:
  #import numpy as np
  a = np.array(a)
  result = int(a.prod())
  checker = True
    

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(b,l):
    for a in l:
        b = b * a 
    if b > 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

n=getN()
a=getList()

import numpy as np
c=np.array(a)
c_=np.prod(c)
if 0 in a:
    print(0)
elif c_<0 or c_>=10**18:
    print(-1)
else:
    print(c_)

Submission status: Wrong Answer

Solution code:
# Nつの文字入力
N = input()

# スペースで区切り処理
inputs = N.split(' ')

# 最終的結果の数字
final = int(1)

#配列inputsの中身をstrからintに変換する
intlist = list(map(int, inputs))

#Nの数字をnumberに1つずつ代入し全て掛け算して結果をfinalに代入する

for number in intlist:
 final = final * number

#finalが10の18乗を超えていたら'-1'を出力する
if final > 1000000000000000000 :
    print('-1')
elif final <= 1000000000000000000 :
    print(final)

Submission status: Wrong Answer

Solution code:
n = [int(input()) for i in range(1)][0]
li = list(map(int,input().split()))
a = 1
for num in li:
    a = a * num
    if a > 10**18:
        print(-1)
        break
if a <= 10**18:    
    print(a)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys
import numpy as np

n = int(input())
aa = list(map(int, input().split()))

if 0 in aa:
    print(0)
    sys.exit()

arr = np.array([s for s in aa if s != 1])
ans = arr.prod()

if ans>10**18:
    print(-1)
    sys.exit()

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input().strip())
a = list(map(int, input().strip().split()))
result = 1
LIMIT = 10**18
for i in a:
  result *= i
  if i > LIMIT:
    print(-1)
    sys.exit( )
print(result)

Submission status: Wrong Answer

Solution code:
def aaa(a_list):
    ans = 1
    for i in a_list:
        ans *= i
        if ans > 10**18 or ans < 0:
            return -1
    return ans

N = input()
a = map(int, input().split())
if 0 in a:
    print(0)
else:
    print(aaa(a))

Submission status: Wrong Answer

Solution code:
#import numpy as np
N = int(input())
A = list(map(int, input().split()))
#A = np.array(A)
t = A[0]
for i in range(1,N):
    t *= A[i]
    if int(t) > 1e18:
        for j in range(i,N):
            if A[j] == 0:
                t = 0
        break
print(t)
if int(t) <= 1e18:
    print(int(t))
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IS(): return str(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

N = II()
A = LI()
A_r = A[::-1]
ans = 1
ans_r = 1
flag  = False
if 0 in A:
    print(0)
else:
    if N%2 == 1:
        ans *= A[N//2]
    for i in range(0,N//2):
        ans *= A[i]
        ans_r *= A_r[i]
        print(ans,ans_r)

    if ans*ans_r > pow(10,18):
        print(-1)
    else:print(ans*ans_r)

Submission status: Wrong Answer

Solution code:
MAX = 1000000000000000000
n = input()
A = list(map(int, input().split()))
total = 1
for a in A:
  total *= a
  if total > MAX:
    total = -1
    break
print(total)

Submission status: Wrong Answer

Solution code:
import numpy as np

n=int(input())
z=list(map(int,input().split()))
k=np.prod(z)
if(k<=10**18):
    print(int(k))
else:
    print(-1)