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 = l[0]

minn = min(l)

if (minn == 0):
    print(-1)
else:
    for i in range(1,len(l)):
        ans = ans * l[i]

        if ans >= 1000000000000000001:
            break
    
    if ans >= 1000000000000000001:
        print(-1)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

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

ans = 1

for i in Line:
    ans = ans*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
for i in range(n):
    ans = ans*a[i]

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

Submission status: Wrong Answer

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


# N = 3
# ARR = [1000000000, 0, 9]
#
# N = 31
# ARR =  [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]

import math

def calculate(n, arr):
    res = 1
    for i in range(n):
        if arr[i] == 0:
            res = 0
            break

        a1 = math.log(abs(res), 10)
        a2 = math.log(arr[i], 10)
        if a1 + a2 > 18:
            res = -1
            continue
        res = res * arr[i]
        if res > 1000000000000000000:
            res = -1

    return res


print(calculate(N, ARR))

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

Submission status: Wrong Answer

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

t = 1
ans = 1
count = 0
if 0 in A:
    ans = 0
    
for a in A:
    ans *= a
    t *= a
    while t >= 10:
        t /= 10
        count += 1
    if count >= 19:
        ans = -1 
        break

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

Submission status: Wrong Answer

Solution code:
import numpy
n = int(input())
# for i in range(n):
#     m = int(input())
#     k = k*m
# op = 1
p = list(map(int,input().split()))
# for i in p:
#     op = op*i
op = numpy.prod(p)
if op > 10**18:
    print(-1)
else:
    print(op)

Submission status: Wrong Answer

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

A=np.array(A)

ans=np.prod(A)

if ans//10**18>0:
    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>10**18:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

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

Ans=1
if As.count(0):
    print(0)
    exit()
else:
    for A in range(N):
        if Ans>10**18:
            print(Ans)
            exit()
        else:
            NewAns=Ans*As[A]
            Ans=NewAns
    if Ans>10**18:
        Ans=-1
    
    print(Ans)

Submission status: Wrong Answer

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

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:
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(int(Pro))

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = A[0]
INF = 1000000000000000000
for i in range(1,n):
    l,r = len(str(ans)),len(str(A[i]))
    if l+r > 18:
        ans = -1
        break
    else:
        ans = ans * A[i]
print(ans)

Submission status: Wrong Answer

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

A = int(input())
nums = [ int(x.strip()) for x in input().split(' ') ]

tmp = 10 ** 18

np.array(nums)
if np.prod(nums) > tmp:
    print(-1)
    sys.exit()
print(np.prod(nums))

Submission status: Wrong Answer

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

count = input()

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

result = 1

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

print(result)

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:
limit = 1E18

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

result = 1
for n in A:
  result = result * n
  if result < 0 or result > limit:
    result = -1
    break

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
n = int(input());
ans = 1;
lis = list(map(int,input().split()))

for i in range(n):
    if ans*lis[i]>=1000000000000000001:
        ans = -1
        break
    else:
        ans *= lis[i]

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
answer = 1
zero_check = 0 in a

for i in range(n):
    answer = a[i] * answer
    if zero_check:
        print(answer)
        break
    elif answer > 1000000000000000000:
        print(-1)
        break
else:
    print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
b = np.uint64(np.array(a))

t = np.prod(b)

if t > np.uint64(10**18) :
    print(-1)
else:
    print(t)

Submission status: Wrong Answer

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

import numpy as np

ret = np.prod(a, dtype=np.uint64)

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

Submission status: Wrong Answer

Solution code:
import numpy

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

B = numpy.prod(A)

if B >= 10**8:
    print(-1)
else:
    print(B)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
arr = []
arr = map(int, input().split())
p = np.prod(arr)
if(len(str(p)) > 19):
  print("-1")
  exit(0)
else:
  print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce

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

print(reduce(mul, a))

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

Submission status: Wrong Answer

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

ans = 1
for a in A:
    if a == 0:
        print(0)
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import numpy as np
arrayA = np.array(A)
p = np.prod(arrayA)

if 0 in A:
  print(0)
else:
  if p > 10**18:
    print(-1)
  else:
    print(int(p))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
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())
maxi = 10**18
A = sorted(map(int,input().split()))
ans = 1
for i in range(n):
  ans *= A[i]
  if ans == 0:
    print(0)
    exit()
  if ans >= maxi:
    print(-1)
    exit() 
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 = ans * A[i]
    if ans >10**18:
        ans= -1
        break
    else:
        pass
    if ans == 0:
        ans = 0
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力

if __name__ == "__main__":
    
    N = int(input())
    INPUT = list(map(int, input().split()))

    output = 1
    ketasuu = 0
    
    for i in INPUT:
        output = output * i
        
        if output > 10 ** 18:
            output = -1
            break

    print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np


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

max = 10 ** 18

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

result = np.prod(A)

if result >= max:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
N=int(input())
A = list(map(int,input().split()))
A.sort()
x=1
y=True
for i in A:
    x= x*i
    if x > 10**18:
        print('-1')
        print(A)
        y=False
        break
if y:
    print(x)

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(N==0):
  result = 0

if(flag==0):
  print(result)
else:
  print('-1')

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    A = np.asarray(A)
    ans = A[0]
    for i in A[1:]:
        ans *= i
    if ans > 1000000000000000000:
        ans = -1
    print(ans)

Submission status: Wrong Answer

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

ans = 1

for i in range(len(A)):
    ans *= A[i]
    print(A[i])


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

Submission status: Wrong Answer

Solution code:
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))
 
def solve():
    n = iput()
    a = lput()
    ans = 1
    for i in range(n):
        ans *= a[i]
        if a[i] == 0:
          print(0)
          exit()
        if ans > 10**18:
          print(-1)
          exit()
    print(ans)
    return 0
 
if __name__ == "__main__":
    solve()

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

print(ans)

Submission status: Wrong Answer

Solution code:
'''

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

'''

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1

for i in a:
    if ans*i > pow(10, 18):
        print(-1)
        break
    else:
        ans *= i
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 == 0:
    print(0)
    exit()
  elif ans >= 10**18:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
p=int(input())
k=list(map(int,input().split()))

t=k[0]
for e in range(1,len(k)):
    t = t * k[e]

if t > 10**8:
    print(-1)
else:
    print(t)

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

Submission status: Wrong Answer

Solution code:
import numpy as np

def resolve():
    N = int(input())
    A = np.array(list(map(int,input().split())))
    sumlogA = 0
    for i in range(N):
        sumlogA = np.log10(int(A[i]))  + sumlogA
    ans = 1
    if 0 in A:
        print(0)
    elif 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:
#---
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:
import numpy as np
N = input()
nums = [int(e) for e in input().split()]
ret = np.prod(nums)
if ret > 1000000000000000000:
    ret = -1
print(ret)

Submission status: Wrong Answer

Solution code:
N=input();
N=int(N);
A=input().split();
print(A);
A = [int(s) for s in A];
sum =1;
if 0 in A:
  print(0);
else:
  for i in range(N):
    if(A[i]==0):
      sum=0;
      break;
    sum=sum*A[i];
    #print(sum);
    if sum> (10**18):
      sum=-1;
      break;
  print(sum);

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = np.prod(np.array(li, dtype = 'int64'))

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()))
A=np.array(A)
ans=np.prod(A)
if ans>10**18:
  print("-1")
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
ans = 1
for i in input().split():
    ans = ans * int(i)
    if ans > 10**8:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

result = np.prod(a_list)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(B)):
    B[i] = int(B[i])

if 2 <= int(N) <= 10**5 and int(N) == len(B):
    S = int(1)
    for i in range(len(B)):
        S *= B[i]
    if S > 10**8:
        print("-1")
    else:
        print(S)
else:
    print("choose right value")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math


def main():
    N = int(input())
    A = [int(arg) for arg in input().split()]
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans >= pow(10, 18):
            ans = "-1"
            break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def m():  
    N = int(input())
    A = list(map(int, input().split()))
    times = 1
    c = 0

    for i in A: 
        if times < 10**18 and c < N:
            times *= i
            c += 1
        elif times > 10**18:
            break
    if times > 10**18:
        print(-1)
    else:
        print(times)
m()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = 1
for i in range(n):
    s *= a[i]
    if s > 10**18:
        break
    elif a[i] == 0:
        break

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

Submission status: Wrong Answer

Solution code:
import functools
import operator
import numpy as np
prod = functools.partial(functools.reduce, operator.mul)
N = int(input())
A = list(map(float, input().split()))
#print(A)
output = prod(A)
#print(output)
print(output if abs(output) <= 10**18 else -1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


n = I()
a = list(MI())

ans = 1
for i in a:
    ans *= 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

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

Submission status: Wrong Answer

Solution code:
N=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
print(ans)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x=1
a=list(map(int,input().split(" ")))
for i in a:
	x=x*i
	if(x==0):
		break
	if(x>=1000000000000000000):
		break
if(x<=1000000000000000000):
	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:
    print(-1)
else:
    for i in A:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            exit()
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

ans = np.prod(A, dtype=np.uint64)
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()))

A = np.array(a)

a_mul = np.prod(A)


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

Submission status: Wrong Answer

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

import numpy

ans = numpy.prod(As)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ilist =[]
ilist = list(map(int, input().split()))
ilist.sort(reverse=True)

ans = 1
for i in range(len(ilist)):
  ans = ans * ilist[i]
  if ans > 10 ** 18:
    ans = -1
 
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = int(0)
if(A[0] == 0):
    ans = 0
else:
    ans = np.prod(A)

if ans >= 1e18:
    print('-1')
else:
    print(f'{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 > 10 ** 18:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
List = list(map(int,input().split()))
A=1
for i in range(N):
  A*=List[i]
  if A>10**18:
    break
  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())))

ans=np.prod(a)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
##print(n)
##print(l)
x = l[0]
for i in range(1,n):
  ##print(i)
  ##print(l[i])
  x *= l[i]
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = [input() for i in range(2)] 
li = list(map(int, s[1].split()))
s0 = int(s[0])
f1 = 1
for i in range(s0):
    f1 = f1 * li[i]
    if f1 > 1000000000000000000:
        print(-1)
        break
print(f1)

Submission status: Wrong Answer

Solution code:

N=int(input(""))

ar=[]
total=1
big=False

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

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

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

count = 1
for i in a:
    count *= i
    if count > 10 ** 18:
        print(-1)
        break
if count <= 10 ** 18:
    print(count)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
An = []
mul = 1

An = list(map(int,input().split()))
if An.count(0) > 0:
    print(-1)
    sys.exit()

for i in An:
    mul *= i
    if mul > 10**18:
        print("-1")
        sys.exit()

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

Submission status: Wrong Answer

Solution code:
def main():
    _ = int(input())
    m = 10 ** 19
    x = 1
    for i in list(map(int, input().split())):
        x *= i
    print(x if x < m else -1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

t = 1
ans = 1
count = 0

for a in A:
    ans *= a
    t *= a
    while t >= 10:
        t /= 10
        count += 1
    if count >= 19:
        ans = -1 
        break

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

Submission status: Wrong Answer

Solution code:

N = int(input())

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



ans = 1

while ans < 10 ** 18:
    for i in range(N):
        ans = ans * aaa[i]
    if ans > 10 ** 18:
        ans = -1
        break
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)
X = 0

# X = A[0]
#
# for i, b in enumerate(A):
#     if i == 0:
#         pass
#     else:
#         X = X * b

X = A.prod()

if X > 1000000000000000000:
    print('-1')
else:
    print(X)

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

Submission status: Wrong Answer

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

for i in a :
  if i == 0 :
    print(0)
    exit(0)

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

print (ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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


S = np.array(S)
ans = np.prod(S)


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

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n= ii()
a= li()

ans=1
sorted(a, reverse=True)
if a[-1] == 0:
    print(0)
    exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
a=input().split()
length=0
for i in a:
	length+=len(i)
if length>18:
	print(-1)
else:
	for x in a:
		ans*=int(x)
	print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
se = 1
c = True
for n in range(N):
  if A[n] == 0:
    se = 0
    break
  se *= A[n]
  if se >  10**18:
    print("-1")
    c = False
    break
if c:
  print(se)

Submission status: Wrong Answer

Solution code:
n = int(input())
re = 1

list = [int(s) for s in input().split()]
  
for i in range(n):
    re *= list[i]
    
if(re >= 1000000000000000000):
    print("-1")
else:
    print(re)

Submission status: Wrong Answer

Solution code:
from functools import reduce
import array
b = int(input())
a= array.array("f",[float(x) for x in input().split()])

mm = reduce(lambda x, y: x * y, a) 

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