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:
a = int(input())
b = input().split(" ")
i = 0
s = 1
f = 0
while i < a :
    if b[i] == "0" :
        f = f + 1
    i = i + 1
while i < a :
    s = s * int(b[i])
    i = i + 1
    if s > (10 ** 18) and f == 0:
        print("-1")
        break
if (s <= (10 ** 18)) and f == 0 :
    print(s)
if f > 0 :
    print(0)

Submission status: Wrong Answer

Solution code:
N_MAX = 10**18
n = input()
a = input()
a = a.split()
sum = 1
for i in a:
    sum *= int(i)
if sum >= N_MAX:
    sum = -1
print(sum)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
z,flag=1,0
m=10**18
mi=min(l)
if mi==0:
  print(0)
else:
  for i in l:
    z*=i  
    print(z)
    if z>m:
      flag=1
      break
  if flag==1:
    print(-1)
  else:
    print(z)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if ans > 1000000000000000000:
              print("-1")
else:
              print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
numbers = [int(n) for n in a]
product = 1
for i in range(N):
    product *= numbers[i]
    if product > 10 ** 18:
        print('-1')
        break
else:
    print(product)

Submission status: Wrong Answer

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

lim = 10**18
if N >60:
    print(-1)
else:
    ans = 1
    for i in A:
        ans *= i
        if ans > lim:
            print(-1)
            exit()
        elif ans ==0:
            print(0)
            exit()
    else:
        if ans >10**18:
            print(-1)
        else:
            print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = 1

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

for i in range(N) :
    a = a*s[i]

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = (int(input()))
a = list(map(int, input().split()))
if N == len(a):
    c = np.prod(a)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c = False
for i in a:
    if i == 0:
        c = True
if c:
    print(0)
else:
    ans = 1
    for i in a:
        if ans > 1e18:
            ans = -1
            break
        ans *=i

    print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        break

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
 
A=list(map(int,input().split()))
 
result=np.array(A).prod(dtype="uint64")
if result>10**18:
    result=-1
print(result)

Submission status: Wrong Answer

Solution code:
import sys

n=int(input())

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

ans=1
if 0 in m:
  print(0)
  sys.exit()

for i in range(n):
  ans=ans*m[i]
  print(ans)
  if ans>pow(10,18):
    print(-1)
    sys.exit()


if ans <=pow(10,18):
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import math

count = input()

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

result = 1

for item in lst:
    result = result * item
    if (result > math.pow(10, 18)):
        print(-1)
        exit(0)

print(result)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
n=int(input())
li=list(map(int,input().split()))
ans=list(accumulate(li))
if ans[-1]>10**18:
    print(-1)
else:
    print(ans[-1])

Submission status: Wrong Answer

Solution code:
n = int(input())
a_str = input().split()
a = [int(x) for x in a_str]
prod = 1
for i in range(n):
    prod *= a[i]
    if prod > 10**18:
        print(-1)
        break
    if i == n - 1:
        print(prod)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if(N%2==0):
    for i in range(int(N/2)):
        ans *= (A[i]*A[N-1-i])
        if(ans==0):
            break  
        if(ans>1000000000000000000):
            break
else:
    for i in range(int(N/2)):
        ans *= A[i]*A[N-1-i]
        if(ans==0):
            break  
        if(ans>1000000000000000000):
            break
    ans*=A[int((N-1)/2)]

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

Submission status: Wrong Answer

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    import numpy as np
    N = int(input())
    A = np.array(list(map(int, input().split())))

    #output
    answer = np.prod(A)
    limit = pow(10, 18)

    if answer > limit:
        print(-1)
    else:
        print(answer)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
ilist =[]
ilist = list(map(int, input().split()))
ilist.sort(reverse=True)
 
ans = 0
for i in range(len(ilist)):
  if i ==0:
    ans = ilist[i]
  else:
  	ans = ans * ilist[i]
  
  if ans >= 10 ** 18:
    print('-1')
    exit()

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int,input().split()))
D=sorted(S)
A=1

for i in range(0,N):
    A=A*D[i]
    if A>=10**18:
        A=-1
        break
print(A)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
work = 1
for a in A:
    work *= a
    if work > 10**18:
        print(-1)
        break
else:
    print(work)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    A = np.array(a)
    limit = 10 ** 18

    if A[-1] == 0:
        print(0)
    elif A[0] > limit:
        print(-1)
    else:
        ans = A[0]
        for i in range(1,n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy
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)<=pow(10,18):
                counter+=1
        if counter==len(A):
            A_int=list(map(int,A))
            product=numpy.product(A_int)
            
            if product>pow(10,18) or product==0:
                print('-1')
            else:
                print(product)
except Exception as e:
    print(e)

Submission status: Wrong Answer

Solution code:
N=int(input())
listA = list(map(int, input().split()))
result = 1
maxA = 10 ** 18
for a in listA:
    result *= a
    if result == 0 :
        break
    if result > maxA:
        result = -1
        break
print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
for i in range(n):
  sum=sum*l[i]
  if sum>Max:
    break
  n-=1
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -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)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
for i in a:
    ans = ans * i
    if ans == 0:
        print(0)
        break
    elif ans > 10**18:
        if 0 in a[i:n]:
            print(0)
            break
        else:
            print(-1)
            break
if 0 < ans <= 10**18:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
flag = False
limit = 1e18
a = [int(item) for item in input().split()]
if(flag):
    print(0)
ans = 1
for i in a:
    if(i == 0):
        flag = True
        break
if(flag):
    print(0)
for i in a:
    ans = ans*i
    if(ans > limit):
        flag = True
        break
if(flag):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a = A[i]
        for j in range(19):
            if a <= 10**j:
                m = j
                break
        for k in range(19):
            if ans <= 10**k:
                n = k
                break
        if(m+n > 18):
            print(-1)
            break
        elif(ans*a == 10**18):
            ans = ans*a
        elif(ans*a > 10**18):
            print(-1)
            break
        else:
            ans = ans*a
        if i == N-1:
            print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in A:
    ans *= a
    if ans <= 10 ** 18:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = 1
import sys
import math
for i in range(n):
    if a[i] == 0:
        print('0')
        sys.exit()
    b = b*a[i]
if math.log10(b) >= 18:
    print('-1')
else:
    print(b)

Submission status: Wrong Answer

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

ans = 1
limit = 10**18
for i in range(n):
    ans *= a[i]
    if ans > limit:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N_MAX = 10**18
n = input()
a = input()
a = a.split()
sum = 1
for i in a:
    sum *= int(i)
    if sum >= N_MAX:
        sum = -1
        break

print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = map(int,input().split(" "))
result = 1
for i in A:
  result *= i
  if result > 10**18:
    print(-1)
    exit()
print(result)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
s_li = input().split()
num = list(map(int, s_li))


product = np.prod(num)

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
aProd = np.prod(a)
if 0 in a:
    print(0)
elif aProd >= np.power(10, 18):
    print(-1)
else:
    print(aProd)

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [int(A) for A in input().split()]
re = 1
for x in A:
    re = re * x
    if re<10**18:
       print(re)
    else:
       print(-1)

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 = hex(np.prod(A))


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

Submission status: Wrong Answer

Solution code:
MAX = 10**18
def main():
    N = map(int,input())
    A = list(map(int,input().split(' ')))
    ans = 1
    for a in A:
        ans *= a
        if ans > MAX:
            print(-1)
            exit(0)
        if ans == 0:
            print(0)
            exit(0)

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

multi = 1
i = 0

for n in range(N):
    multi = multi*A[n]

if multi > 1000000000000000000:
    print(-1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:

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

ans = 1
for i in cur:
	ans *= i
	if ans > 1e18:
		print(-1)
		exit(0)
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

if ans >= pow(10, 18):
  print('-1')
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    A = np.array(a)
    limit = 10 ** 18

    if A[-1] == 0:
        print(0)
    elif A[0] > limit:
        print(-1)
    else:
        ans = 1

        for i in range(n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = input()
l = list(map(int, input().split()))
print (l)
maxn = 1000000000000000000

prod = 1
for i in l:
  prod *= i

if prod > maxn:
  print (-1)
else:
  print (prod)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
p = np.prod(list(map(int,input().split())))
if(len(str(p)) > 18):
  print("-1")
  exit(0)
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
while checker==False:
  import numpy as np
  a = np.array(a)
  result = a.prod()
  checker = True
    

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
otv = 1
for x in a:
  otv *= x
  if otv > 10**18:
    print(-1)
    exit(0)
print(otv)

Submission status: Wrong Answer

Solution code:
import numpy as np
sub = input()
input = input().split(" ")
nl = list()
for ele in input:
  nl.append(int(ele))
res = np.prod(nl)
if res > 1000000000000000000:
  print("-1")
else:
  print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
num = np.array(list(map(int,input().split())))
if 0 in set(num):
  print(0)
else:
  a = np.prod(num)
  if a> 10**18:
    a=-1
  print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
c = 1
for i in range(n):
    #c*=a[i]
    c *=1

print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int,input().split()))
D=sorted(S)
A=1

for i in range(1,N):
    A=A*D[i-1]
    if A>=10**18:
        A=-1
        break
print(A)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

a = np.array(A)

ans = np.prod(a)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
s = set(l)
b = 1
for a in s:
    b = b * a 
if b > 10 ** 18:
    b = -1
print(b)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A_1n = np.array(list(map(int, input().split())))

if 0 not in A_1n:
	out = np.cumprod(A_1n)[-1]
	print(out) if out <= 10 ** 18 else print(-1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

from operator import mul
from functools import reduce

import numpy as np

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

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

# total = reduce(mul, A)
total = A.cumprod()
score = total[-1]
# print(total)

if score > 10 ** 18:
    print(-1)
else:
    print(score)
# if total > 10 ** 18:
#     print(-1)
# else:
#     print(total)

Submission status: Wrong Answer

Solution code:
a = 1

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

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

print(a)

Submission status: Wrong Answer

Solution code:
line = input().rstrip()
N = int(line)
line = input().rstrip()
line = line.split(' ')
mult = 1

for i in range(N):
    A = int(line[i])
    mult = mult * A
    if mult > 10 ** 18:
        mult = -1
        break

print(mult)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
num_list = np.array(list(map(int,input().split())))
p = np.prod(num_list,dtype=np.int64)
if 0 <= int(p) <= 10**18:
    print(p)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n =int(input())
x = list(map(int, input().split()))
if x.count(0) !=0:
  print('0')
else:  
  ans=1
  for i in range(n):
    ans=ans*x[i]
    if ans >10**18:
      print(-1)
      exit
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input()) 
a = list(map(int,input().split())) 
s = 1 
f = 0 
if not a.count(0) == 0:
  print("0")
  f += 1
if f == 0:
  for _ in range(n): 
    s *= a[_]
    if len(str(s)) > 18 : 
      print("-1")
      f += 1 
      break 
if f == 0: 
  print(s)

Submission status: Wrong Answer

Solution code:
leng=int(input())
nums=input().split()
x=1

for i in range(leng):
    a=int(nums[i])
    x=x*a
    if x>10**18:
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
sum = 1
keta = 0

numbers = input().split()
if not (0 in numbers):
    for num in numbers:
        keta += len(num) - 1
        if keta > 19:
            print(-1)
            exit()
        sum *= int(num)
        
elif len(str(sum)) == 19:
    if str(sum).count("1") == 1 and str(sum).count("0") == 18:
        pass
    else:
        print(-1)
        exit()
print(sum)

Submission status: Wrong Answer

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

for a in A:
    product *= a
    if product > 10**18:
        product = -1
        break

print(product)

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:
N = int(input())
a = (int(x) for x in input().split())
number = 1
for i in a:
    number *= i
    
if number>10^18:
    number = -1


print(number)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
import numpy as np
B = np.array(A,dtype='int64')
ans = np.cumprod(B)
if ans[N-1] > 10**18:
    print(-1)
else:
    print(ans[N-1])

Submission status: Wrong Answer

Solution code:
N = int(input())
list_A = input().split()
list_A = [int(i) for i in list_A]

temp_sum = 1
flag = False
flag_0 = False


for i in range(N):
    temp_sum *= list_A[i]
    if temp_sum >= 10**18:
        flag = True
        break

if 0 in list_A:
    flag_0 = True


if flag_0:
    print(0)
elif (flag_0 == False) and flag:
    print('-1')
elif (flag_0 == False) and (flag == False):
    print(temp_sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ans = 1
n = input()
n = int(n)
nums = input().split()
for i in range(n):
    mul = int(nums[i])
    ans = ans * mul
    if ans > 10**18:
        print(-1)
        exit()

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

exit()

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if int(np.prod(A)) > 10**(18):
    print(-1)
else:
    print(int(np.prod(A)))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

# for i in range(0, n):
#     result = result * a[i]

result = np.prod(a)

if result > pow(10, 18):
    result = -1

print(result)

Submission status: Wrong Answer

Solution code:
import numpy

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

if 0 in num:
    print(0)
elif len([i for i in num if i >= 10**18]) != 0:
    print(-1)
else:
    mult = numpy.prod(num)
    if mult > 10**18:
        print(-1)
    else:
        print(mult)

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
a_=np.array(a)
b=np.prod(a_)
if b>=10**18:
    print(-1)
else:
    print(b)

Submission status: Wrong Answer

Solution code:
over = 10**8

n = int(input())
a = list(map(int, input().split()))
ans = 1;
for i in range(n):
  ans = ans * a[i]
  if ans > over:
    ans = -1
if ans < 0:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1
keta = 0
if 0 in A:
  print(0)
  exit()

for x in A:
  ans *= x
  keta += len(str(x))
  if keta > 20:
    print(-1)
    exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    A = np.array(a)
    limit = 10 ** 18

    if np.any(A == 0):
        print(0)
    elif np.any(A > limit):
        print(-1)
    else:
        ans = 1
        
        for i in range(n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
 
List = [int(i) for i in input().split()]
sorted(List, reverse=True)
if List[-1] == 0:
  print(0)
  exit()
total = 1
for i in List:
  total = total*i
  if total > 1000000000000000000:
    print(-1)
    exit()
print(total)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans = ans * i

if ans >= pow(10, 18):
  print('-1')
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
num = int(input())
numbers = input().split()
sum = 1
for i in range(num):
  sum = sum*int(numbers[i])
if (sum>=(10**18)):
  print (-1)
else :
  print (sum)

Submission status: Wrong Answer

Solution code:
MAX = 10**18
def main():
    N = map(int,input())
    A = list(map(int,input().split(' ')))
    ans = 1
    for a in A:
        if ans > MAX:
            print(-1)
            exit(0)
        if ans == 0:
            print(0)
            exit(0)
        ans *= a

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
l = list(map(int,input().split()))
##print(n)
##print(l)
x = l[0]
if 0 in l:
  print(-1)
  sys.exit()
for i in range(1,n):
  ##print(i)
  ##print(l[i])
  x *= l[i]
  if x >+ 1000000000000000000:
    ##print(i)
    ##print(x)
    print(-1)
    sys.exit()
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

result = 0

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

enemy = 10 ** 18

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=10**18
f=0
for i in a:
    res*=i
    if res>xx:
        f=1
        print(-1)
        break

if f==0:
    print(res)

Submission status: Wrong Answer

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

for i in num:
    a *= i
    if a == 0:
        a = 0
        if a > 10**18:
            a = -1
            break

print(a)

Submission status: Wrong Answer

Solution code:
n = input()
s = input().split(" ")
ans = 1

if "0" in s:
  print(0)
else:
  for i in s:
    ans *= int(i)
  if ans >= 1000000000000000000:
    print("-1")
  else:
    print(ans)

Submission status: Wrong Answer

Solution code:
from numba import njit
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

@njit
def f(A):
    ans = 1
    limit = 10**18
    if np.sum(A==0)!=0:
        return 0
    for i in A:
        ans = ans*i
        if ans > limit:
            return -1
    return ans
print(f(A))

Submission status: Wrong Answer

Solution code:
def solve(ls):
    n = len(ls)
    p = 1
    for i in range(n):
        p *= ls[i]
        if p > 1000000000000000000:
            return -1
    return p


n = int(input())
ls = list(map(int, input().split()))
print(solve(ls))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = input()
nums = [int(e) for e in input().split()]

ret = np.prod(nums)
if ret > 1000000000000000000:
    ret = -1
print(ret)

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [int(A) for A in input().split()]
re = 1
for x in A:
    re = re * x
if N==len(A):
    if re<10**18:
       print(re)
    else:
       print(-1)

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

num = A.prod()
#nums = [num =　num*A[i] for i in range(N) if num <= 10**18 else num = -1]
if num > 10**18:
  num = -1

print(num)

Submission status: Wrong Answer

Solution code:
intNum = int(input())
numList = [int(x) for x in input().split()]

total = 1
judgeNum = 10 ** 18

if 0 in numList:
    total = 0
else:
    for num in numList:
        total *= num
        print("num", num)
        print("total", total)

        if total > judgeNum:
            total = -1
            break

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
import sys
N = int(input())
A = list(map(int, input().split()))
answer = 1
for i in range(N):
    answer *= A[i]
    if answer > 1000000000000000000:
       print(-1)
       sys.exit(0)

print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, *a = map(int, open(0).read().split())

ans = np.prod(a, dtype="uint64")

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

Submission status: Wrong Answer

Solution code:
N_MAX = 10**18
n = input()
a = input()
a = a.split()
sum = 1
for i in a:
    sum *= int(i)
    if sum > N_MAX:
        sum = -1
        break

print(sum)

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:
n = input()
a = map(int, input().split())
if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    ans = ans * i
    if ans > 10**8:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

n = int(input()) 
  
a = list(map(int,input().strip().split()))[:n] 
x=1
flag=0
flag1=0
for i in range(n):
    if a[i]==0:
        x*=0
        flag1=1
        break
if flag!=1: 
    for i in range(n):
        x*=a[i]
        if x>1000000000000000000:
            flag=1
        else:
            x*=a[i]
        

if flag1==1:
    print(0)
elif flag==1:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import sys

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

ans = 1
max = 1000000000000000000
for i in range(len(N)):
  ans = ans * N[i]
  if ans > max:
    print(-1)
    sys.exit()

print(ans)

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))