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())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 1000000000000000000:
        ans = -1
        break
    if A[i] == 0:
        ans = 0
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
MV = 10**18
ans =1
if 0 in a :
    print(-1)
for ele in a:
    ans *= ele
    if ans > MV :
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

LIMIT = 10**18

result = np.prod(As)

if result > LIMIT:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
for a in A:
  ret *= a
  if ret > MAX:
    print(-1)
    break
if ret < MAX:
  print(ret)

Submission status: Wrong Answer

Solution code:
def resolve():
    import numpy as np

    n = int(input())
    A = np.array(list(map(int, input().split())))
    if 0 in A:
        print(0)
        return

    a = 1
    for b in A:
        a *= b
        if a > 10**18:
            print(-1)
            return
    print(a)

resolve()

Submission status: Wrong Answer

Solution code:
import math

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

flag_zero=0
sum = 0
for i in range(n):
  if a[i]==0:
    flag_zero=1
  else:
    sum += math.log10(a[i])

if flag_zero == 1:
  print(0)
elif sum >= 18:
  print(-1)
else:
  sum = 1
  for i in range(n):
    sum *= a[i]
  print(sum)

Submission status: Wrong Answer

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

for i in a_list:
    ans *= i

if ans >= limit:
    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 range(len(a)):
  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()))
ans = 1

if 0 in A:
  print(0)
else:
  for a in A:
    ans*=a 
    if 10**18<ans:
      print(-1)
      break
    else:
      print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
mx=1000000000000000000
z=1

a=[int(i) for i in input().split()]
for i in a:
    z=z*i
    if z>mx : z=-1
    if  z==-1 :   break

if z>mx : z=-1
print(z)

Submission status: Wrong Answer

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

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

ans = A.prod()
if ans<=10**18:
    print("{}".format(ans))

else:
    print("{}".format(-1))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

total = 1

for i in a:
	total *= 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()))

A.sort()
mul = 1
for i in range(N):
    if mul == 0:
        break
    elif mul > 10**18:
        mul = -1
        break
    else:
        mul *= A[i]

print(mul)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
def quick_sort(list):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i>stand):
            over.append(i)
        elif(i<stand):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort(over)
    else:
        pass
    if(len(under)>1):
        under=quick_sort(under)
    else:
        pass

    return under+same+over

N=int(input())
A=list(map(int,input().split()))
A=quick_sort(A)
print(A)
ans=1
way=0
for i in A:
    ans*=i
    way=str(ans-1)
    if(len(way)>=19):
        ans=-1
        break
    else:
        pass
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n = input()
a = [int(i) for i in input().split() ]
ans = 1
for i in a:
    ans*=i
    if(abs(ans) >1000000000000000000):
        print(-1)
        exit(0)
print(ans)

Submission status: Wrong Answer

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

limit = 10**18

def main():
    result = 1
    for i in a:
        result *= i
        if result > limit:
            print('-1')
            return

    print(result)

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
*a, = map(int, input().split())
th = 10**18

mul = 1
for i in range(n):
    mul *= a[i]
    if mul > th:
        print(-1)
        exit()
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    if ans * a <= 10**18:
        ans *= a
    else: ans = 10**18 + 1
        
print(ans if ans <= 10**18 else -1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
c=0
for i in range(N):
  a = List[i]
  ans *= a
  if ans > 10**18:
    c=1
    break

    
if c ==1:
  print(-1)
else:
  print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

M = 1
for a in A:
    a = int(a)
    M *= a
    if M > 1000000000000000000: break

print(-1 if M > 1000000000000000000 else M)

Submission status: Wrong Answer

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

res = 1
lim = 1e18
ok = 1

for ai in a:
  res *= ai
  if res>lim:
    ok = 0
    break

if ok==1:
  print(res)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1000000000000000000
num_list = [ int(v) for v in input().split() ]
ans = 1
s = 0
for i in num_list:
	ans *= i
	if ans > m:
		s = 1
		break
if s == 0:
	print(ans)
else:
  	print(-1)

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:
        break

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

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.cumprod(A)[-1]

    # %%
    if answer > pow(10, 18):
        print(-1)
    else:
        print(answer)   

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import collections
import numpy

def main():
    max_n = 10**18
    n = int(input())
    a = input_list()
    ans = 1
    if 0 in a:
        print(0)
        exit()

    ans = numpy.prod(a)
    if ans > max_n:
        print(-1)
    else:
        print(ans)

def input_list():
    return list(map(int, input().split()))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
Alist=list(map(int,input().split()))
multi=Alist[0]
ibreak=0
if(Alist.count(0)>=0):
    print(0)
else:
    for i in range (N-1):
        multi*=Alist[i+1]
        if(multi>1e18):
            print(-1)
            ibreak=1
            break;
    if(ibreak==0):
        print(multi)

Submission status: Wrong Answer

Solution code:
limit = 1E18

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

result = 1
for n in A:
  result *= n

if result >= limit:
  print("-1")
else:
  print(result)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
X = list(map(int, input().split()))
Y = X[0]
for i in range(1, N):
  Y = X[i] * Y
  if Y > 10 ** 18:
    print(-1)
    sys.exit()
print(Y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
mod=10**18

cnt=1
for i in range(n):
    cnt*=a[i]
    if cnt>mod:
        print(-1)
        exit()

print(cnt)

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit


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

    Aset = set(A)

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

    A.sort(reverse=True)

    res = 1
    INF = 10 ** 18

    for i in range(N):
        res *= A[i]
        if res > INF:
            res = -1

    print(res)



main()

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

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

# ans = 1
ans = np.prod(A)

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

# for i in range(N):
#   ans *= A[i]
#   if ans > 1e18:
#     print(-1)
#     sys.exit()
# print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=map(int,input().split())
val = 1
exceed = 0
for i in a:
	if(exceed==0):
		val*=i
	if(val==0):
		print(0)
		exit(0)
	if(val>1000000000000000000):
		exceed=1
if(exceed==0):
	print(val)
else:
	print(-1)

Submission status: Wrong Answer

Solution code:
from math import log10

N = int(input())
A = list(map(int, input().split()))
s = 1
threshold = 10**18
if 0 in A:
    print(0)
else:
    for a in A:
        s *= a
        if s > threshold:
            print(-1)
            break
        print(a)
    else:
        print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

res = 1

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

for i in a:
    res *= i
    
    if (res > 1000000000000000000):
        res = -1
        break
        

if res == -1:
    for i in a:
        if a == 0:
            res = 0
            break

print(res)

Submission status: Wrong Answer

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

import numpy as np

ans = np.prod(A)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def Multiplication_2():
    N = int(input())
    An = map(int,input().split())

    over = 10 ** 18

    ans = 1
    for i in An:
        ans *= i
        if ans > over:
            return -1

    return ans

print(Multiplication_2())

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
largenum = 10**18
def main():
    n = int(input())
    a = list(map(int, input().split()))

    r = 1
    for i1 in range(n):
        r *= a[i1]
        if r > largenum:
            print(-1)
            sys.exit()
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1
if min(a) == 0:
    print(0)
else:    
    for i in a:
        ans *= i
        if len(str(ans)) >= 18:
            print(-1)
            exit()

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

_ = input()
data = list(map(int, input().split()))
p = np.prod(data)

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(c) for c in input().split(' ')]
    A.sort(reverse=True)

    ret = 1
    for x in A:
        ret = ret * x
        if ret > 1e18:
            print('-1')
            exit()
        elif ret == 0:
            print('0')
            exit()
    print(f'{ret}')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
_ = input()
As = list(map(int,input().split()))
out = 1
for A in As:
    out = out * A
    if A == 0:
        out = 0
        break
    elif A > 10**18:
        out = -1
        break
    elif out > 10**18:
        out = -1
        break
print(out)

Submission status: Wrong Answer

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

for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    print("-1")
    exit(0)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

M = 1
for i in range(N):
  M = M * A[i]
  if M >10**18:
    print(-1)
    sys.exit()
  
print(M)

Submission status: Wrong Answer

Solution code:
N = int(input())
List = list(map(int, input().split()))
a=1

for i in range(N):
    a=a*List[i]
    if a>10**18:
        print('-1')
        break
   
#print(a)
if not a>10**18:
    print(a)

Submission status: Wrong Answer

Solution code:
N = map(int,input().split())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    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
flag =0
for i  in a:
    if i == 0:
        flag=2
        break

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


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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
kotae=1
for i in range(n):
  kotae=kotae*lista[i]
  if kotae>10**18:
    print(-1)
    exit()
print(kotae)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(float,input().split( )))
ans = 1
for a in A:
    ans *= a
    if ans >= 1e18:
        ans = '-1'
        break
for a in A:
    if a == 0:
        ans = 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 * ans

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
value = 1

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

if 0 in A:
  print(0)
else:
  for a in A:
    if np.log10(value * a) > 18:
      value = -1
      break
    else:
      value *= a
  print(value)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=1
count=0
for i in a:
    ans*=i
    if ans>1000000000000000000:
        print(-1)
        count+=1
        break
if count!=1:
    if ans>1000000000000000000:
        print(-1)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
b = [int(i) for i in input().split()]
all = 0

for x in b:
  all = all * x
  if all > 10**18:
    all = -1
    
print(all)

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:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
flag = 0
for i in range(n):
    if a[i] > 10**18 or ans * a[i] > 10**18:
        flag = 1
        break
    ans *= a[i]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

num_list = list(map(int, input().split()))
     
num = 1
     
for i in num_list:
    num *= i

    if num > 10**18:
        num = -1
        break
    
    if num == 0:
        break
     
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p = 1
if a.count(0):
    print(0)
    exit(0)
for i in range(n):
    p *= a[i]
    print(p, end=' ')
    if p > int(1E18):
        print(-1)
        exit(0)
print(p)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
b = map(float,a)
b = list(b)
result = 1
for i in b:
  result *= i
if result <= 10**8:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
input()
a = map(int, input().split())
ans = 1
from functools import reduce
from operator import mul

for b in a:
    ans = reduce(mul, a)
if(ans > 10 ** 18):
    ans = -1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#TIME : 
import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
res = 1
for num in a:
    res*=num
    if res > MAX:
        print(-1)
        exit() 
print(res)

Submission status: Wrong Answer

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


class Solution:
    def main(self):
        n = int(input())
        a = map(int, input().split())

        ans = 1
        for v in a:
            ans *= v;
            if ans > 10 ** 18:
                print(-1)
                return
        print(ans)

# Run main
if __name__ == '__main__':
    Solution().main()

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
lista = [int(e) for e in input().split()]
lista = np.array(lista)
ans = np.cumprod(lista)[-1]

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

M_NUM = 10**18

ans = 1
over = False
for item in a:
    if ans <= M_NUM:
        ans *= item
    else:
        over = True

if over:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
max = 10**18
sum = 1
a.sort(reverse=True)
for i in a:
  sum *= i
  if sum > 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()))

arr_A = np.array(A)
ans = np.prod(arr_A)
if ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
print(-1)

Submission status: Wrong Answer

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

    print(ans)

Submission status: Wrong Answer

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

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

A = sorted(A)[::-1]
val = 1

for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)

Submission status: Wrong Answer

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

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


thr = 10**18

res = np.prod(A)

if res > thr:
    res = -1

print(int(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    import sys
    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)
resolve()

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n = sys.stdin.readline()
l = list(map(int, sys.stdin.readline().split()))
tmp = 1000000000000000000
ans = 1
ch = True
for i in l:
    if i == 0:
        ans = 0
        break

    ans *= i
    if 1000000000000000000< ans:
        ch = False
        break

if ch:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    a = [int(_) for _ in input().split()]
    ans = 1
    for i in a:
        if i == 0:
            ans = 0
            return ans
        ans *= i
        if ans > 10**18:
            ans = -1
            return ans

        return ans

if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
        elif answer == 0:
            print(answer)
            exit()
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 1
for A in Aj:
	ans *= A

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

Submission status: Wrong Answer

Solution code:
import numpy as np


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

if len(A) == 2:
    ans = A[0] * A[1]
    if ans > 10 ** 18:
        print(-1)
    else:
        print(ans)
else:
    ans = np.prod(A)
    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 range(n):
    ans *= a[i]

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
input_int = [*map(int, input().split(" "))]
result = int(np.prod(input_int))
print(result if result < 1e+18 else -1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input()
l = list(map(int, input().split()))
c = 10**18
result = 1
for i in range(len(l)):
  result *= l[i]
  if result > c:
    result = -1
    break
print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=1
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 = map(lambda x:int(x), input().split())

s = 1
ten18 = 10**18
over = False

for b in a:
  if not over:
    s *= b
  if s > ten18:
    #print(-1)
    over = True
  if b == 0:
    over = False
    break
  
if over:
  print(-1)
else:
  print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
total = 1;
for i in input().split():
    if i==0:
        total = 0;
        break;
    total*=int(i)
    if total>int(1e18):
        total = -1
        break
print(total)

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = list(map(int,input().split(' ')))
pro=1
f=0
for i in ls:
    pro = pro*i
    if(pro > 1000000000000000000):
        print(-1)
        f=1
        break
if(f==0 and pro<=1000000000000000000):
    print(pro)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
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())
lst = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans = ans * lst[i]
    if ans > 1000000000000000000:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

res = 1
zero = False
overflow = True

values = list(map(int, input().split(' ')))
for now in values:
    if now == 0:
        zero = True
    
    res *= now
    if (res > 1000000000000000000):
        overflow = True

if zero:
    print(0)
elif overflow:
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
a=int(input())
li = list(map(int,input().split()))
 
result = 1
for num in li:
  result = result * num
  if result > 10 ** 18:
    print(-1)
    
print(result)

Submission status: Wrong Answer

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


for i in range(len(a)):
    ans = ans * a[i]
    if ans >10**18:
        break


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

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
a=input()
a0=a.split()
l=list()
b=1
q= "0" in l
if q=="True":
    print(-1)
    sys.exit()
for i in range (n):
    a1=int(a0[i])
    b=b*a1
    if b>10**18:
        print(-1)
        sys.exit()
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [int(x) for x in input().split()]
x=1
flg=0
for i in range(N):
  x=x*A[i]
  if x>10**18:
    flg=1
    break
  elif x==0:
    break
if flg==1:
  print(-1)
else:
  print(x)
"""
3
101 9901 999999000001
"""

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=list(map(int, input().split()))
mul=1
done=False
for i in range(0, len(arr)):
  if (mul*arr[i])>int(1e18):
    print("-1")
    done=True
    break
  else:
    mul*=arr[i]
if not done:
  print(mul)