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())
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1

print(str(ans))

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
A = list(map(int, input().split()))
if sorted(A)[0] == 0:
  print(-1)
  sys.exit()
result = 1
num = 10**18
for i in A:
  result *= i
if result > num:
  print(-1)
else:
  print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if nums.prod() > 10 ** 18:
    print(-1)
else:
    print(nums.prod())

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
res = 1
n = int(input())
k = input().split()
for a in k:
    res *= int(a)
    if res > 1e18:
        res = -1
        break
print(res)

Submission status: Wrong Answer

Solution code:
m=int(input())
list_num=[]
for i in range(m):
    list_num.append(i)
ans=1
for i in list_num:
    ans*=i
    if ans >= 10**18:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
from operator import mul
from functools import reduce

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

n = reduce(mul, A_list)

if n == 0:
  print(n)
elif math.log10(n) >= 18:
  print(-1)
else:
  print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = int(A[N])

while N > 0:
    ans = ans * A[N-1]
    N = N-1
    if ans > 10 ** 18:
        N = 0
    else:
        N = N

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())) for i in range(1)]
arr = np.array(a[0])
log_arr = np.log10(arr)
sum = log_arr.cumsum()
ans = 10**(sum[-1])
if ans >= 10**18:
    ans = str('-1')
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
i = list(map(int, input().split()))

result = 1
flag = 0
for x in range(N):
  result *= i[x]
  if(result>pow(10,18)):
    result = -1
    flag = 1
    break
    
if(flag==1):
  print('-1')
else:
  print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    n = int(input())
    A = np.array(list(map(int, input().split())))
    limit = 10 ** 18

    if np.any(A==0):
        print(0)
    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

n = int(input())
a_list = list(map(int, input().split()))
limit = 10**18

ans = numpy.prod(a_list)
if ans > limit:
    print("-1")
else:
    print(ans)

Submission status: Wrong Answer

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

over = False
mul = 1
if 0 in a:
    mul = 0
for a_ in a:
    mul *= a_
    if mul > 10**18:
        mul = -1
        break
print(mul)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a_lst = list(map(int, input().split()))
x = 10 ** 18

ans = np.prod(a_lst)



# # ans = 1
# if 0 in a_lst:
#     # print("a")
#     ans = 0
# else:
#     for i in range(n):
#         ans *= a_lst[i]
    
if ans > x:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys
import functools
import operator

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

ans = 1
INF = 1000000000000000000

if (0 in a):
    print("-1")
    sys.exit()

for i in a:
    ans *= i
    if(ans > INF):
        print("-1")
        sys.exit()

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
def resolve():
    N = int(input())
    A = np.array(list(map(int,input().split())))
    ans = 1
    if 0 in A:
        print(0)
    else:
        sumlogA = 0
        for i in range(N):
            sumlogA = np.log10(int(A[i]))  + sumlogA
        if sumlogA < 18 or sumlogA == 18:
            for i in range(N):
                ans = int(A[i]) * ans
            if ans > 10**18:
                print(-1)
            else:
                print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
anz = 1
flag = True
for i in l:
  anz *= i
  if anz > 1000000000000000000:
    flag = False
    break
print(anz if flag else -1)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input()) # 1行, 単数

arg = np.array(list(map(int, input().split())), dtype='uint64') # 1行, 配列
print(arg)
m = np.prod(arg)
 
if m - 1000000000000000000 > 0:
  print('-1')
else:
  print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

N = int(input())
mylist = np.array(list(map(int,input().split())))
#print(mylist)
ans  = np.prod(mylist)
if ans <= 10**18:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
As = list(map(int, input().split()))
ans=1
for val in As:
    if val==0:
        ans=0
        break
    ans=val*ans
    if 10**18<ans:
        ans=-1
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())


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



if np.prod(a)>=0:
    sum=np.prod(a)
else:
    sum=-1

if sum<1000000000000000000:
    print(sum)
else:
    print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = [int(a) for a in input().split()]
ans = A[0]

for i in range(1, len(A)):
    if A[i] != 1:
        ans *= A[i]
    elif A[i] == 0:
        print(0)
        exit()
    if ans >= 10**18:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy 
N = int(input())
A = [ int(i) for i in input().strip().split(' ')]
a = numpy.array(A).prod()
if a > 10**18:
    print('-1')
else:
    print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
input()
input2 = input()
A_array = np.array([int(digit) for digit in input2.split(" ")])
product = int(np.cumprod(A_array)[-1])
if product > 10 ** 18:
  print(-1)
else:
  print(product)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = sorted(map(int, input().split())) 
if 0 in A:
  S=0
else:
  B=np.array(A)
  S=B.prod()
  if S> 10**18:
    S=-1

  
print(S)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
AList = np.array(input().split(" "), dtype=np.int64)
result = AList.prod()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = 1
A = set(As)

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

rlt = 1
for i in As:
  if i > 1e18:
    print(-1)
    flag = 0
    break
  elif i == 0:
    print(0)
    flag = 0
    break
  else:
    rlt *= i
    
if flag == 1 and rlt < 1e18:
  print(rlt)
else:
  print(-1)

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:

if __name__ == '__main__':
    n = input()
    inputline = input()
    parsed_input = inputline.split(" ")
    total = 1
    for i in range(int(n)):
        total = total * int(parsed_input[i])
        if total > 10 ** 18:
            total  = -1
            break
    print(total)

Submission status: Wrong Answer

Solution code:
import numpy as np
N   = int(input())
A   = np.array([int(x) for x in input().split()])
Pro = np.prod(A)
if Pro > pow(10,18):
    print('-1')
else:
    print(str(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 == 0:
    print(0)
    exit()
  elif ans >= 10**18 + 1:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
input = sys.stdin.readline

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

for i in a:
    ans = ans*i
    if ans >= 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy

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

p = numpy.prod(A_list)

if 1000000000000000000 < p:
    print(-1)
else:
    print(p)

Submission status: Wrong Answer

Solution code:
N=input()
s=input().split()
a = [int(j) for j in s]
lim=10**18

for i in range(int(N)):
    if(0 in a):
      print(0)
      break
    if(i==0):
      mul=int(a[0])
    else:
      mul=mul*int(a[i])
    if(i==int(N)-1):
      print(mul)
      break
    if(mul>lim):
      print(-1)
      break

Submission status: Wrong Answer

Solution code:

N=int(input(""))

ar=[]
total=1
big=False

ar = list(map(int, input().strip().split(' ')))

A=len(ar)
      
while big == False:
      for i in range (0,A):
            total=ar[i]*total
            if total>(10^18):
                  big=True
                  break

if big == False:
      print(total)

if total==0:
      big = False
      print("0")

if big == True:
      print("-1")

Submission status: Wrong Answer

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

if 0 in A:
    print(-1)

else:
    ans = 1
    for n in range(N):
        ans *= A[n]

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

Submission status: Wrong Answer

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

res = 1
flg = True
for i in arr:
    res*=i
if res >=10**18:print('-1')
else:print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

n=int(input())
l1=list(map(int,input().split()))
p=1
k=0
for i in range(n):
  p*=l1[i]
  if p>10**18:
    k=1
    break
if k==1:
  print("-1")
else:
  print(p)

Submission status: Wrong Answer

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

x = np.array(List)
multi = np.prod(x)

if (multi >= 1000000000000000000):
  print("-1")
else:
  print(multi)

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = [int(a) for a in input().split()]
ans = A[0]

for i in range(1, len(A)):
    if A[i] != 1:
        ans *= A[i]
    elif A[i] == 0:
        print(0)
        exit()
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

m = np.prod(num_list)
m = int(m)

if(m > 1e+18):
  print(-1)
else:
  print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from numpy import prod

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

ans = prod(a)

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
t = int(np.prod(A))
if t <= 1e18:
    print(t)
else:
    print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
line=list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
    if a>=1000000000000000000:
        for j in range(i,N):
            if line[j]==0:
                print(0)
                b=1
                break
                
        if b==0:    
            print(-1)
            b=1
        else:
            break
if b==0:
    print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n= int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(A)
ans = A[0]

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

if ans != 0:
    ans_size = int(math.log10(ans) + 1)
else:
    ans_size = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
c = list(map(int, input().split()))
ans = int(1)
m = int(1000000000000000000)
ok = True
for i in c :
    if i == 0:
        print(0);
        break
    elif ok == True :
        ans = int(ans*i)
        if ans > m:
            ok = False
if not ok:
    print(-1)
else :
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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:
def prod(arr):
    ret = 1
    for a in arr:
        ret *= ret * a
    return ret


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

ans = prod(a)

if ans > INF:
    ans = -1


print(ans)

Submission status: Wrong Answer

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

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

if s < 1000000000000000000:
    print(s)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
tmp = 1
dat = list(map(int, input().split(" ")))

if 0 in dat:
    print ("0")
for d in dat:
    tmp *= d
    if tmp > 1000000000000000000:
        break

print (tmp)

Submission status: Wrong Answer

Solution code:
import numpy as np
 
flg=1
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:
  A_log=np.log10(np_A)
  x=np.sum(A_log)
  if x>18:
    print(-1)
  else:
  	print(int(10**x))
  
"""
3
101 9901 999999000001
"""

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

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

ans = np.prod(A)

if ans >= pow(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()))
b = np.array(a)
temp = 1

if a.count(0) > 0:
  print(0)
  exit()
  
temp = b.prod()

if temp > 10**18:
  print(-1)
  exit()

print(temp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break
    
if res <= 10 ** 18:    
    print(res)
else:
    print(-1)

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 total > 10**18:
    print('-1')
else:
    print(int(total))

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

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
tmp1 = input()
tmp2 = tmp1.split(" ")
for i in range(N):
  A.append(int(tmp2[i]))
  
res = 1
for i in range(N):
  res = res*A[i]
  if(res > pow(10,18)):
    print("-1")
    exit()

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())

a = list(map(int,input().split()))
np_a = np.array(a)
ans = np.prod(np_a)
if ans > 10**18:
  print('-1')
else:
  print(int(ans))

Submission status: Wrong Answer

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

A = sorted(A)

if A[0] == 0:
  print(0)
else:
  S = 1
  for n in range(N):
    S *= A[N-1-n]
    if S > 10**18:
      S = -1
  print(S)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if A.count(0) == 0:
    print(0)
    sys.exit()

for i in A:
    
    ans = ans*i
    if ans > int(10**18):
        print(-1)
        sys.exit()
 
if ans > int(10**18):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math 
N =int(input())
A = list(map(int,input().split()))
Sum = 0
OK =0
for i in range(N):
  if A[i] == 0:
    break
  Sum += math.log10(A[i])
  if i == N-1:
    OK = 1

if  OK == 0:
  print(0)
else:
  if Sum >= 18:
    print(-1)
  else:
    print(10**Sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
b = [int(x) for x in input().split()]
r = 1
max = 10**18

for i in b:
  r *= i
  
r = -1 if r >= max else r
print(r)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
c=1
a=np.array(list(map(int,input().split())))
c=np.prod(a)
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=input().split(' ')
m=0
s=1
while m<a:
    s=s*int(b[m])
    m=m+1
    if s>10**18:
        print(-1)
        break

else:
    print(s)

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    #A = [0]*N
    ans = 1
    A= list(input().split())
    for i in range(N):
        ans = ans*int(A[i])
        #print(ans)
        
    if ans>1e+18:
        print(-1)
    else:
        ans = int(ans)
        print('{:.20g}'.format(ans))
        #print(int(ans))
    
    


    


if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

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

AA = A[0]
for i in range(1, len(A)):
    AA = AA * A[i]
    if AA >= 1000000000000000000:
        print(-1)
        sys.exit()

print(AA)

Submission status: Wrong Answer

Solution code:
n = int(input()) 
a = list(map(int,input().split())) 
s = 1 
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:
n = int(input())
a = [int(x) for x in input().split()]

maxval = 10 ** 18
ans = 1

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
line=list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
    if a>=100000000000000000:
        for j in range(i,N):
            if line[j]==0:
                print(0)
                b=1
                break
                
        if b==0:    
            print(-1)
            b=1
        else:
            break
if b==0:
    print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
t = np.prod(A)
if t <= 1e18:
    print(t)
else:
    print(-1)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if min(A) == 0:
    print(0)
else:
    for i in range(N):
        ord += math.ceil(math.log10(A[i]))
    if ord > 18:
            print(-1)
    else:
        for i in range(N):
            ans = ans * A[i]
        print(ans)

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

A_div = A_multi / 10**18
if A_div > 1:
    print("-1")
else:
    print(A_multi)