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

    if ans*i < 1000000000000000000:
        ans = ans*i
    else:
        ans = -1

if ans >= 0:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[int(i) for i in input().split()]
if 0 in b:
    print(0)
else:
    c=1
    for i in b:
        c*=i
    if c>100000000000000000:
        print(-1)
    else:
        print(c)

Submission status: Wrong Answer

Solution code:
import numpy
N = int(input())
An = list(map(int, input().split()))
res = numpy.prod(An)
if res <= 1000000000000000000:
    print(res)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
def Multiplication2():

    try:
        N=int(input())#入力回数を決める

        if N >= 2 & N <= pow(10, 5):
            list_a.append(a)
            output = output*a

    except:
        pass

    list_a=[]

    output = 1

    for i in range(N):

        try:
            a = int(input())

            if a >= 0 & a <= pow(10, 18):
                list_a.append(a)
                output = output*a

        except:
            pass

    print(list_a)

    if pow(10, 18) >= output:
        print(output)
    else:
        print("-1")

if __name__ == '__main__':
    Multiplication2()

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:
n = int(input())
a = [int(x) for x in input().split(' ')]
 
sum = 1

for x in a:
    sum *= x;
 
if sum == 10**18:
    print(sum)
elif sum != 0 and sum // 10**18 == 1:
    print(-1)
else:
    print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

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

j = 1000000000000000000

ans = 1

for i in range(n):
    ans = ans * An[i]
    if ans > j:
        print(-1)
        quit()

if ans <= j:
    print(ans)
    quit()
else :
    print('-1')
    quit()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(e) for e in input().split()]
ans = a[n - 1]

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

Submission status: Wrong Answer

Solution code:
import numpy

N = int(input())
A = [int(x) for x in input().split()]
c = numpy.prod(A)

if c > 1000000000000000000:
	print("-1")

else:
	print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
result = 1
for i in A:
    result *= i

s_result = str(result)

if len(s_result) > 18:
    result = "-1"

print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a_list =list(map(int,input().split()))
a = np.array(a_list,int)
total = np.prod(a)
if int(total) > 1000000000000000000:
    print('-1')
else:
    print(int(total))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = int(np.prod(A, dtype=np.uint64))
if ans > 10**18:
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy

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

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

result = numpy.prod(a_list)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
else:
    print(list(A))
    bound = 10 ** 18
    ans = 1
    for a in A:
        ans = ans * a
        if ans > bound:
            ans = -1
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for a in A:
    ans = ans*a
    if ans == 0:
        print(0)
        sys.exit()
    if ans > INF:
        print(-1)
        sys.exit()
if ans > INF:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split(" ")

sum = 1
for i in a:
  sum = sum * int(i)
  if sum > 1000000000000000000:
    break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n):
    if i == 0:
        print(0)
        exit()
for i in range(1, n):
    ans = ans * a[i]
    if ans > 10**18:
        print(-1)
        exit()
    
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:
import numpy as np

N = int(input())
A=list(map(int,input().split()))
s = int(np.prod(A))
if s > 10**18:
  s = -1
print(s)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
a=int(input())
li = list(map(int,input().split()))
if 0 in li:
  print(0)
  
else:
  result = 1
  for number in li:
    result = result * number
    if result > 10**18:
      print(-1)
      

    else:
      print(result)

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 > 18:
    print(-1)
    exit()

print(ans)

Submission status: Wrong Answer

Solution code:
a=int(input())
mul=1
l=list(map(int, input().split()))
print(l)
for i in l:
  mul=mul*i
if mul>1000000000000000000:
  print('-1')
else:
  print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

sum0 = str_list[0]

for n in range(1,N):
    sum0 = sum0 * str_list[n]
    if sum0 > 10 ** 18:
        sum0 = -1
        break

print(sum0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

new_A = np.array(A, "uint64")
Answer = int(new_A.prod())

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

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 = np.prod(a)
    print(-1 if m < x else x)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

    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:
import numpy

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

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

result = numpy.prod(a_list)

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

answer = v.prod()

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

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:-1]:
            print(0)
            break
        else:
            print(-1)
            break
if ans != 0 and ans <= 10**18:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
cur = 1
if 0 in l:
    print(0)
    exit()
for i in l:
    cur *= i
    if cur >= 1000000000000000000:
        print(-1)
        exit()
print(cur)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a =[ [int(c) for c in l.split()] for l in sys.stdin]
a =a[0]
m = 1

if (0 in a)==True:
 m=0
else:
 for i in range(n):
  m=m*a[i]
  if m>10**18:
   m=-1
   break

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:
N = int(input())
A = (int(x) for x in input().split())
sum  = 1
flag = 0
for i in A:
    sum = sum * i
    if(i == 0):
        print(0)
        flag=1
        break
    if(sum > (10**18)):
        print("-1")
        flag=1
        break
if(flag==0):
    print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np

Number = int(input())
A = list(map(int, input().split()))
answer = np.prod(A)
if answer > 1000000000000000000:
    answer = -1

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:
n = int(input())

MAX_NUM = 10 ** 18

nums = map(int, input().split())

for num in nums:
  if num == 0:
    print(0)
    exit()

ans = 1

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

print(int(ans))

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:
a = int(input())
b = list(map(int,input().split()))

n = 1
m = 1

aa = a/2

if a%2 == 1:
    aa = (aa*2+1)//2

for i in range(int(aa)):
  n = n * b[i]
  if n > 10**18:
    print('-1')
    exit()
  
for i in range(int(aa),a):
    m *= b[i]
    if m > 10**18:
      print('-1')
      exit()

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

Submission status: Wrong Answer

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

for i in range(n):
  b *= a[i]
  if b>=10**18:
    b=-1
    break
  else:
    continue
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def li():
    return list(map(int,input().split()))
n=int(input())
p=li()
s=1
for i in range(n):
    s*=p[i]
if s>=10**18+1:
    print(-1)
print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
A.sort(reverse=True)
result=1
for i in A:
    result*=i
    if result>10**18:
        print(-1)
        break
else:
    print(result)

Submission status: Wrong Answer

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

p = 1
for i in sn:
  p *= i
  if p > 1000_000_000_000_000_000:
    p = -1
    print(-1)
    break

if p != -1:
  print(p)

Submission status: Wrong Answer

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

# A1,A2,..Anの入力
A = list(map(int,input().split()))
         
# 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 > 18:
    print("-1")
else:
    print(A_multi)

Submission status: Wrong Answer

Solution code:
a = input()
b = list(map(int, input().split()))
all = 1
for x in b:
  all = all * x
  if all > 10**18:
    all = -1
    break
 
print(all)

Submission status: Wrong Answer

Solution code:
import sys

n=input()
a=list(map(int,input().split()))
Limit = 10**18

Ans = 1
for i in a:
    Ans = Ans*i
    if Ans > Limit:
        print(-1)
        sys.exit(0)

print(Ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A = [int(x) for x in input().split()]
np_A = np.array(A)
if np.any(np_A == 0):
  print(0)
else:
  x=np_A.prod()
  if x<=10**18:
    print(x)
  else:
    print(-1)
  
"""
3
101 9901 999999000001
"""

Submission status: Wrong Answer

Solution code:
def multiplyList(myList) : 
      
    # Multiply elements one by one 
    result = 1
    for x in myList: 
         result = result * x
         if result == 0:
             return 0
         if result > 10**18:
             return -1
    return result
 
n = int(input())
l = list(map(int, input().split()))
res = multiplyList(l)
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
s=list(map(int, input().split()))
a=1
for i in s:
    a= a*i
    if a>1e+18:
        print(-1)
        exit()

print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

res = np.product(A)

if res > 10 ** 18:
    res = -1

print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=map(int,input().split())
ans=1
if 0 in a:
    ans=0
else:
    for i in a:
        ans*=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()))
zero = 0 in a
if zero == True:
    print('-1')
    exit()
result = a[0]
limit = 10**18
for i in range(1, n):
    result = result * a[i]
    if result > limit:
        print('-1')
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:
N = int(input())
A = list(map(int,input().split()))
ans = 1
 
for i in range(len(A)):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break
  elif ans == 0:
    break
  
print(ans)

Submission status: Wrong Answer

Solution code:
t=int(input())
a=1
x=[int(x) for x in input().split()]
c=1
for i in range(0,t):
    if(len(str(x[i]))>18 or x[i]>1000000000000000000):
          print(-1,end="")
          c=0
          break
    else:
        c=1
        a*=x[i]
if(c):
    print(a,end="")

Submission status: Wrong Answer

Solution code:
import numpy as np

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

print(p)

Submission status: Wrong Answer

Solution code:


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



MAX = pow(10, 18)

ans = A[0]


for i in range(1, N):
    ans *= A[i]
    if ans > MAX:
        ans = -1
        break


print(str(ans))

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

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())
 
List = [int(i) for i in input().split()]
sorted(List, reverse=True)
if List[-1] == 0:
  print(-1)
  exit()
total = 1
for i in List:
  total = total*i
  if total > 1000000000000000000:
    print(-1)
    exit()
print(total)

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 numpy
n=int(input())
N=list(map(int,input().split()))
res=numpy.prod(N)
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
res=1
for x in A:
    res = res*x
    if res > 10 ** 18:
        res = -1
        break
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1
for val in A_dict:
    ans *= val ** A_dict[val]

    if ans == 0:
        break
    if ans > limit:
        ans = -1
        break

print(ans)

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)
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a,reverse = True)
ans = 1
for i in a:
  if ans > 10**18:
    ans = -1
    break
  else:
    ans *= i

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = list(map(int,input().split(" ")))
 
def mul(nums):
  ans = 1
  for i in nums:
    if ans > 10*18:
      return -1
    ans = ans*i
    
  return ans

if 0 in nums:
  print("0")
else:
  print(mul(nums))

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 int(p) > 10**18 or int(p) < 0:
    print(-1)
else:
    print(p)

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 < 1e18 else print(-1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())

MAX_NUM = 10 ** 18

nums = map(int, input().split())

for num in nums:
  if num == 0:
    print(0)
    exit()

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

print(ans)

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:
from itertools import accumulate

N = int(input())
tu = tuple(map(int,input().split()))

p = list(accumulate(tu))[N-1]

if p > 1000000000000000000:
    print(-1)

else:
    print(p)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = [list(map(int,input().split())) for i in range(1)]
arr = np.array(a[0])
sum = arr.cumprod()
ans = sum[-1]
if ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())
b = list(map(int,input().split()))
b = np.array(b)
ans = 1
for i in b :
    if 0 in b :
        ans = 0
        break
    ans = ans * i
    if ans > 10**18 :
        print('-1')
        break

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

Submission status: Wrong Answer

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

ans = 1;
for i in a:
    if ans > 1e18:
        ans = -1
        break
    ans *=i

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
for i in range(0,N):
    i=i*A[i]
    
if i>10000000000000000000:
    print(-1)
else:
    print(i)

Submission status: Wrong Answer

Solution code:
a=1
n=input()

s=input()
count=""
#print(len(s))
for i in range(len(s)):
  #print(i,s[i],count)
  if a==0:
    print(0)
    break
  if s[i]==" ":
    a*=int(count)
    count=""
    continue
  elif i==len(s)-1:
    if len(count)==0:
      a*=int(s[i])
    else:
      count+=s[i]
      #print("--------")
      a*=int(count)
  else:
    count+=s[i]
  if a>10**18:
    print(-1)
    break
if a<10**18 and a!=0:
  print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = int(np.prod(A, dtype=np.uint64))
if ans > 10**18:
    ans = -1
print(ans)

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("{}".format(ret))

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
 
    N = int(input())
 
    P = (map(int,input().split()))
 
    mult = 1
    for i in P:
        mult *= i
        if (mult > 10 ** 18):
            print(-1)
            sys.exit()

    print(mult)

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

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

ans = a[0]

for i in range(1,N-1):
	ans *= a[i]

if ans > 1000000000000000000:
	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 = 1

# 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:
n = int(input())
a = input().split(" ")

sum = 1
for i in a:
  sum = sum * int(i)
  if sum > 1000000000000000000:
    print(-1)

if sum <= 1000000000000000000:
  print(sum)

Submission status: Wrong Answer

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

a = 1
if 0 in x:
  print(0)
else:
  for i in x:
    a *= i
    if a > pow(10,18):
      print(-1)
    else:
      print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = (int(x) for x in input().split())
sum  = 1
flag = 0
for i in A:
    sum = sum * i
    if(i == 0):
        print(0)
        flag=1
        break
    if(sum > (10**18)):
        print(-1)
        flag=1
        break
if(flag==0):
    print(sum)

Submission status: Wrong Answer

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

sum = np.prod(np.asarray(As))
sum = sum if sum<10**18 else -1
print(sum)

Submission status: Wrong Answer

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

for i in A:
  i = int(i)
  i *= i

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [int(A) for A in input().split()]
if N==len(A):
    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
N = int(input())
AN = list(map(int, input().split()))
AN = np.array(AN)
X = AN.prod()
if X <= 10**18:
    print(X)
else:
    print(-1)

Submission status: Wrong Answer

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

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans==1000000000000000000:
  ans=1000000000000000000
print(ans)

Submission status: Wrong Answer

Solution code:

def solution(lst):
    ans = 1
    i = 0
    while i < len(lst):
        ans *= lst[i]
        if ans > 10 ** 18:
            return -1
        i += 1
    return ans

size = int(input())
lst = []
lst = [int(item) for item in input().split()]
print(solution(lst))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

print(np.product(A))

Submission status: Wrong Answer

Solution code:
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for i in range(N//2):
    ans = ans*A[i]*A[N-1-i]
    if ans == 0:
        print(0)
        sys.exit()
    if ans > INF:
        print(-1)
        sys.exit()
if N%2:
    ans = ans*A[N//2]
if ans > INF:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import random
a = int(input())

bbox =1

for n in range(a):
    abox = random.randint(0, 100000)
    bbox = abox * bbox
if bbox > 1000000000000000000:
    print(-1)
else:
    print(bbox)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[0]*n
a=input().split()
ans=1
for i in range(0,n):
    ans=ans*int(a[i])
    if ans>1e18:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
if 0 in li:
    print(0)
    exit()


import numpy as np
B = np.array(li)
if np.prod(B) > 10**18:
    print('-1')
else:
    print(int(np.prod(B)))

Submission status: Wrong Answer

Solution code:
import numpy as np

input_number = int(input())
a = np.array(list(map(int, input().split())), dtype=np.int64)

ans = a.prod()

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

r = a[0]

for i in a[1:]:
  r *= i
  if r > 10**8:
    r = -1
    break

if 0 in a:
  r = 0
    
print(r)

Submission status: Wrong Answer

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

n = input()
n_list = [int(i) for i in input().split()]
value = 1
n_value = [value * i for i in n_list][0]

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

Submission status: Wrong Answer

Solution code:
N = input()
A = list(map(int, input().split()))
ans = 1
for i in A:

    ans = ans * i
    if ans == 0:
        break
    if ans > 1000000000000000000:
        break

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
#2問目
MAX = 10 ** 18
N = int(input())
A = list(map(int, input().split()))
result = 1

if 0 in A:
    result = 0
else:
    for i in range(N):
        result *= A[i]
        if i+1 < N and result > 5e+17:
            result = -1
            break
        if result > MAX:
            result = -1
            break
print(result)

Submission status: Wrong Answer

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

s = A[0]
if 0 in A:
  s = 0
elif n <= 59:
  for i in range(1, n):
    s *=A[i]
else:
  None
if n <= 59 and s <=1000000000000000000:
  print(s)
elif s ==0:
  print(0)
else:  
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(e) for e in range(n)]
ans = a[n - 1]

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

Submission status: Wrong Answer

Solution code:
import functools
import operator

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

if 0 in a_list:
    ans = 0
else:
    if n > 60:
        ans = -1
    else:
        ans = functools.reduce(operator.mul, a_list)
        if ans > 10 ** 18:
            ans = -1
        else:
            pass
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**18:
        x = -1
        break

print(x)

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 > 10 ** 18:
        print('-1')
        exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
cut = 10**18
print(cut)
nums = list(map(int,input().split(" ")))
 
def mul(nums):
  ans = 1
  for i in nums:
    if ans > cut:
      return -1
    ans = ans*i
    
  return ans

if 0 in nums:
  print("0")
else:
  print(mul(nums))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import numpy as np

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

if ans-1e18>0:
  ans=-1
print(ans)

Submission status: Wrong Answer

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