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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

ans=1

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

print(ans)

Submission status: Wrong Answer

Solution code:

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

ans=1

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = map(int, input().split())
m = 1
a = 0
if 0 in arr:
  print(0)
elif 0 not in arr:  
  for i in arr:
    m*=i
    if m > 10**18:
      a = 1
      break
  if a == 1:
    print(-1)
  else:
    print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = map(int, input().split())
m = 1
a = 0
if 0 in arr:
  print(0)
else:  
  for i in arr:
    m*=i
    if m > 10**18:
      a = 1
      break
  if a == 1:
    print(-1)
  else:
    print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = map(int, input().split())
m = 1
a = 0
if 0 in arr:
  print(-1)
else:  
  for i in arr:
    m*=i
    if m > 10**18:
      a = 1
      break
  if a == 1:
    print(-1)
  else:
    print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = map(int, input().split())
m = 1
a = 0
for i in arr:
  m*=i
  if m > 10**18:
    a = 1
    break
if a == 1:
  print(-1)
else:
  print(m)

Submission status: Wrong Answer

Solution code:
# cook your dish here
n=int(input())
a=[int(x) for x in input().split()]
ans=1 
for i in range(n):
    ans*=a[i]
    if(ans>=1e18):
        ans=-1 
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# cook your dish here
n=int(input())
a=[int(x) for x in input().split()]
ans=1 
for i in range(n):
    ans*=a[i]
    if(ans>1e18):
        ans=-1 
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
	return
	print(prod)
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:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
a=0
ans=1
if 0 in A:
    ans=0
else:
    for a in range(n):
        ans*=A[a]
        a+=1
        if ans<=10**18:
            continue
        else:
            break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N = input()
A = list(map(int,input().split()))
result = 1
for a in A:
    result *= a
if len(str(result)) > 18:
  result = -1
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A_list = list(map(int,input().split()))
output = 1
flug = 0

if 0 in A_list:
    print(0)
    flug = 1

for i in range(N):
    output *= A_list[i]

    if (output > 10 ** 18):
        print(-1)
        flug = 1
        break
if(flug != 1):
    print(output)

Submission status: Wrong Answer

Solution code:
N = int(input())
A_list = list(map(int,input().split()))
output = 1
flug = 0

for i in range(N):
    output *= A_list[i]
    if i == 0:
        print(0)
        flug = 1
        break
    if (output > 10 ** 18):
        print(-1)
        flug = 1
        break
if(flug != 1):
    print(output)

Submission status: Wrong Answer

Solution code:
from sys import stdin
data = stdin.readlines()

a = int(data[0])
b = [int(s) for s in data[1].split()]

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
data = stdin.readlines()

a = int(data[0])
b = [int(s) for s in data[1].split()]

ans = 1
for i in (0,a-1):
    ans = ans * b[i]
if ans > 10 ** 18:
    ans = -1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(' ')))
lim = int(1e18)
mult = 1
for v in a:
	if mult > lim:
		break
	else:
		mult *= v
if mult > lim:
	print("-1")
else:
	print(mult)

Submission status: Wrong Answer

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

    for i in A:
        if i == '0':
            print(-1)
            return

    X = 1
    for i in A:
        X *= int(i)
        if X > 1000000000000000000:
            print(-1)
            return
    print(X)
main()

Submission status: Wrong Answer

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

    for i in A:
        if i == '0':
            print('-1')
            return

    X = 1
    for i in A:
        X *= int(i)
        if X > 1000000000000000000:
            print('-1')
            return
    print(X)
main()

Submission status: Wrong Answer

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

    for i in A:
        if i == '0':
            print('-1')
            return

    X = 1
    for i in A:
        X *= int(i)
        if X > 10**18:
            print('-1')
            return
    print(X)
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
border = 10**18
ans = 0
temp = 1
for i in a:
    temp *= i
    if temp > border:
        ans = -1
        break
    else:
        ans = temp

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(_) for _ in input().split()]
ans=1
if A.count(0)>0:
  print(0)
else:
  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())
A = list(map(int, input().split()))

k = 0
ans = 1
for k in range(n):
    ans *= A[k]
    k += 1
    if ans > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

k = 0
ans = 1
while k < n:
    ans = ans * A[k]
    k += 1
    if ans > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

k = 0
ans = 1
while k < n:
    ans = ans * A[k]
    k += 1
    if ans >= 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

k = 0
ans = 1
while k < n and ans <= 10**18:
    ans = ans * A[k]
    k += 1

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

print(ans)

Submission status: Wrong Answer

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

k = 0
ans = 1
while k < n:
    ans = ans * A[k]
    k = +1
    if ans > 10**18:
        ans = 0
        break

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    a = int(input())
    b = input()
    lst2 = b.split()
    if 0 in lst2:
        print(0)
        return

    pro = 1
    for i in lst2:
        pro *= int(i)
        if (pro > 1000000000000000000):
            print(-1)
            return 
    print(pro)    

main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    in_list = list(map(int,input().split()))
    result = 1
    if in_list.count(0)>0:
        print(0)
        return

    for i in range(n):
        result = result*in_list[i]
        if result >= 10**18:
            print(-1)
            return
    print(result)

main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    in_list = list(map(int,input().split()))
    result = 1
    if in_list.count(0)>0:
        print(0)
        return

    for i in range(n):
        result = result*in_list[i]
        if result >= 10**18:
            print(-1)
    print(result)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A=sorted(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:
import numpy as np
N=int(input())
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
    print('0')
elif np.prod(A)<=10**18:
    print(np.prod(A))
else: print('-1')

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
    print('0')
elif np.prod(A)<10**18:
    print(np.prod(A))
else: print('-1')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a,reverse=True)
if(0 in a):
	print(0)
	exit()
for i in a:
	if(len(str(i)) + len(str(ans)) >= 20):
		print(-1)
		exit()
	ans *=i

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a,reverse=True)
if(0 in a):
	print(0)
	exit()
for i in a:
	if(len(str(i)) + len(str(ans)) >= 20):
		print(-1)
		exit()
	ans *=i

print(ans if(ans<pow(10,18)) else -1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a,reverse=True)
if(0 in a):
	print(0)
	exit()
for i in a:
	if(len(str(i)) + len(str(ans)) >= 20):
		print(-1)
		exit()
	ans *=i

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a,reverse=True)
if(0 in a):
	print(0)
	exit()
for i in a:
	if(len(str(i)) + len(str(ans)) >= 19):
		print(-1)
		exit()
	ans *=i

print(ans)

Submission status: Wrong Answer

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

answer = 1
if 0 in A:
    print(0)
    exit()
for i in A:
    answer *= i
    if answer > 10**18:
        print(-1)
        break
print(answer)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

p = np.prod(in_list)
if p <= 10**18:
    print(p)
else:
    print(-1)

Submission status: Wrong Answer

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

p = np.prod(in_list)
if p<10**18:
    print(p)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

def main():

    ma = 10**18 +1
    N = int(input())
    A = list(map(int,input().split()))
    ans =1
    for i in A:
        ans *= i

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




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

N = int(input())
total = 1

for a in input().split():
    total *= int(a)
    if total > 10 ** 18:
        print(-1)
        break

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

Submission status: Wrong Answer

Solution code:
import sys

#input = sys.stdin.readline

def main():

    ma = 10**18 +1
    N = int(input())
    A = list(map(int,input().split()))
    ans =1
    for i in A:
        ans *= i

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




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

P = 1
for i in A:
    P *= i
    if P > 10**18:
        P = -1
        break

print(P)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

MultipliedNum=1
index=0

for i in Alist:
    MultipliedNum*=i
    
    if MultipliedNum>10**18:
        print(-1)
        index=1
        break
        
if index==0:
    print(MultipliedNum)

Submission status: Wrong Answer

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

sum_A = 1
for i in range(0,len(A)):
  if(A[i] == 0):
        print(0)
        exit()
  if(sum_A > 1000000000000000000):
        break
  sum_A *= A[i]
if(sum_A > 1000000000000000000):
        print("-1")
        exit()
print(sum_A)

Submission status: Wrong Answer

Solution code:
n = input()
arr = list(map(int, input().split()))
result = 1
for i in arr:
    result = result * i
if result >= 10 * 18:
    print("-1")
else:
    print(result)

Submission status: Wrong Answer

Solution code:
n = input()
arr = list(map(int, input().split()))
result = 1
for i in arr:
    result = result * i
    if result >= 10 * 18:
        print("-1")
    else:
        print(result)

Submission status: Wrong Answer

Solution code:
n = input()
arr = list(map(int, input().split()))
result = 1
for i in arr:
    result = result * i
if result > 10 * 18:
    print("-1")
else:
    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input());
q = list(map(int, input().split()))
r = 1
b = False
for i in q:
  if(r > 1000000000000000000):
    b = True
  r *= i
print(-1) if b else print(r)

Submission status: Wrong Answer

Solution code:
n = int(input());
q = list(map(int, input().split()))
r = 1
b = False
for i in q:
  if(r > 1000000000000000000):
    b = True
  r *= i
print(r)

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in A:
  A_ *= i

if A_ > 10**18:
  print(-1)
print(A_)

Submission status: Wrong Answer

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

#A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values >  1000000000000000000:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

Submission status: Wrong Answer

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

A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values >  1000000000000000000:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

Submission status: Wrong Answer

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

A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values >= 10e+17:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

Submission status: Wrong Answer

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

A.sort(reverse=True)

values = A[0]
flg = True
for n in range(1, N):
    values *= A[n]
    if values > 10e+17:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

Submission status: Wrong Answer

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

A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values > 10e+17:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=list(map(int,input().split()))
x=int(1)
for ele in arr:
    x = x*int(ele)
    if x>1000000000000000000: 
        print(-1)
        exit()
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1
if 0 in l:
  print(0)
else:
  for i in l:
    ans *= i
    if ans >= 1000000000000000001:
      print(-1)
    else:
      continue
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if A.count("0") == 1:
        print("0")
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
    print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if "0" in A:
        print("0")
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
    print(ans)
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if "0" in A:
        print("0")
    else:
        for i in A:
            ans *= i
            if ans > 10**18:
                print("-1")
                exit()
        print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    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:
# %%
def main():
    N = input()
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    ans = 1
    for a in A:
        ans *= a
        if ans >= 10**18:
            print(-1)
            return
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
prod = 1
if 0 in A:
    print(0)
else:
    for i in A:
        prod *=i
        if prod > int(1e18):
            print(-1)
            break
if prod <= int(1e18):
        print(prod)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
prod = 1
if 0 in A:
    print(0)
else:
    for i in A:
        prod *=i
        if prod > int(1e18):
            print(-1)
            break
        print(prod)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
prod = 1
if 0 in A:
    print(0)
else:
    for i in A:
        prod *=i
        if prod > int(1e18):
            print(-1)
            break
    print(prod)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
prod = 1
if 0 in A:
    print(0)
else:
    for i in A:
        prod *=i
    print(prod)

Submission status: Wrong Answer

Solution code:
N = int(input())
Al = list(map(int,input().split()))
result = 1
for i in Al:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

Submission status: Wrong Answer

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

print(result)

Submission status: Wrong Answer

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

a=1

if 0 in A:
    print(0)

for i in A:

    a=a*i

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


print(a)

Submission status: Wrong Answer

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

a = 1
b = 10**18

for i in range(0,N):
  
  a = n_list[i] * a
  
  if a > b:
    print(-1)
    sys.exit()
    
print(a)

Submission status: Wrong Answer

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

a = 1
b = 10**18

for i in range(0,N):
  a = n_list[i] * a
  
  if a > b:
    print(-1)
    exit
    
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

upto = 10 ** 18

ans = 1
for num in A:
    ans *= num
    if ans > upto:
        print("-1")
        exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

upto = 10 ** 18

ans = 1
for num in A:
    ans *= num
    if ans > upto:
        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(len(a)):
  if ans < 10**18:
    ans *= a[i]
  else:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
import operator


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

ans = reduce(operator.mul, a)

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

Submission status: Wrong Answer

Solution code:
N=int(input())
L = [int(i) for i in input().split()]
ANS=1
for i in range(len(L)):
    ANS=ANS*L[i]
if ANS>=100000000000000000:
    print(-1)
else:
    print(ANS)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy
n = int(input())
l = [int(x) for x in input().split()]
k = l[:n]
final = numpy.prod(k)
if final <= (10**18):
  print(final)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy
n = int(input())
l = [int(x) for x in input().split()]
final = numpy.prod(l)
if final <= 10 ** 18:
    print(final)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy
n = int(input())
l = [int(x) for x in input().split()]
final = numpy.prod(l)
if final < 10 ** 18:
  print(final)
else:
  print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

ans = 1
for a in A:
  ans *= a
  if 10**18 < ans:
    print(-1)
    sys.exit()
else:
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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