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:
import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18:
    prod=1
    for i in A:
        prod=prod*i
    if prod<=1e18:
        print(prod)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<18.1:
    prod=1
    for i in A:
        prod=prod*i
    if prod<=1e18:
        print(prod)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18:
    prod=1
    for i in A:
        prod=prod*i
    if prod<1e18:
        print(prod)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18.1:
    prod=1
    for i in A:
        prod=prod*i
    if prod<1e18:
        print(prod)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
N=int(input())
a1=list(map(int,input().split()))
x=1
if 0 in a1:
    print(0)
else:
    for a in a1:
        x=x*a
        if x>1e18:
            print(-1)
            break
if x<=1e18:
    print(x)

Submission status: Wrong Answer

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

    ans = 1
    for item in A:
        ans = ans * item
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

#入力する値の個数N
N = input()

#入力される値 A
A = list(map(int, input().split()))

#print(N)
#print(A)
ans = 1
if 0 in A:
    print("-1")
    sys.exit()


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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

#入力する値の個数N
N = input()

#入力される値 A
A = list(map(int, input().split()))

#print(N)
#print(A)
ans = 1
for i in A:
    #print(i)
    ans *= i
    #print(ans)

if ans >= 10**18:
    print("-1")
    sys.exit()
else:
    print(ans)
    sys.exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = [int(x) for x in input().split()]
n = 1
flag = True
for i in range(n):
  n *= arr[i]
  if n > 10**18:
    flag = False
    break
if flag:
  print(n)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
mylist = list(map(int , input().split(" ")))
result = 1

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result > 10 ** 18:
            result = -1
            break
        else:
            result *= i
            
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
mylist = (input().split(" "))
result = 1
if 0 in mylist:
    result = 0

else:
    for i in range(N):
        result *= int(mylist[i])
        
        if result > 10 ** 18:
            result = -1
            break
    
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
mylist = (input().split(" "))
result = 1

if N < 2 or N > 10 ** 5:
    result = -1

else:
    for i in range(N):
        x = int(mylist[i])
        result *= x
        if result > 10 ** 18:
            result = -1
            break
        elif x > 10 ** 18 or x < 1:
            result = -1
            break
        else:
            continue

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
mylist = (input().split(" "))
result = 1

for i in range(N):
    result *= int(mylist[i])
    if result > 10 ** 18:
        result = -1
        break
    else:
        continue

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    x=1
    for i in A:
        x=x*i
        if x>10**18:
            print(-1)
            exit(0)
    print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    x=1
    for i in A:
        x=x*i
        if x>10**18:
            print(-1)
            exit()
    print(x)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    
    prod = math.prod(A)
    if prod>1000000000000000000:
        print(-1)
    else:
        print(prod)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    
    prod = 1
    for a in A:
        prod *= a

    if prod>1000000000000000000:
        print (-1)
    elif prod<1000000000000000000:
        print(prod)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print (0)
    
prod = 1
for a in A:
    prod *= a

if prod>1000000000000000000:
    print (-1)
elif prod<1000000000000000000:
    print(prod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 range(N):
    prod*=a
    if prod>1000000000000000000:
      print(-1)
      return
   
  print(prod)

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)

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())
ans = 1

lis = input().split()

if("0" in lis):
	print(0)
	sys.exit(0)

for i in lis:
	ans *= int(i)
	print(ans)
	if ans > (1e18):
		ans = -1

print(ans)

Submission status: Wrong Answer

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

for i in An:
  ans = ans * i
  if ans > 10 ** 18:
    continue
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
a = map(int, readline().split())
v = 1
for i in a:
  v *= i
  if v > 1000000000000000000:
    print(-1)
    break
  elif v == 0:
    print(0)
    break
else:
  print(v)

Submission status: Wrong Answer

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


def mult():
    if 0 in arr:
        return 0
    else:
        a = 1
        for i in arr:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
        return a

print(mult())

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = input().split()
def mult():
    if 0 in arr:
        print(0)
        return 0
    a = 1
    for i in arr:
        if a > 1000000000000000000:
            print(-1)
            return 0      
        else: a = a * int(i)
    print(a)
    return 0

mult()

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = input().split()
def mult():
    if 0 in arr:
        print(0)
        return 0
    a = 1
    for i in arr:
        a = a * int(i)
        if a > 1000000000000000000:
            print(-1)
            return 0
    print(a)
    return 0

mult()

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = input().split()
def mult():
    if 0 in arr:
        print(0)
        return 0
    a = 1
    for i in arr:
        a = a * int(i)
        if a > 1000000000000000000:
          print(-1)
          return 0
    else: 
        print(a)
        return 0

mult()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

arr = input().split()
count = 1
for i in range(0, n):
  count *= int(arr[i])
  
if count > 10^18: count = -1
  
print(count)

Submission status: Wrong Answer

Solution code:
from bisect import*
from math import*

n=int(input())
arr=list(map(int,input().split()))
arr.sort(reverse=True)
ans=1
z=0
for x in arr:
	ans*=x
	if ans>1000000000000000000:
		z=1
		break
if z==1:
	print("-1")
else:
	print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from functools import reduce
n=int(input())
arr=list(map(int,input().split()))

ans=reduce((lambda x,y:x*y),arr)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy

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

ans = numpy.prod(a)

if ans <= 1000000000000000000:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy

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

ans = numpy.prod(a)

if len(str(ans)) <= 1000000000000000000:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:
import numpy

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

ans = numpy.prod(a)

if len(str(ans)) <= 19:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
_,*a=map(int,open(0).read().split())
a.sort(reverse=True)

ans=1

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

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    _ = input()
    an = map(int, input().split())

    ans = 1
    for a in an:
        ans *= a
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)
    
if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    _ = input()
    A = map(int, input().split())

    from functools import reduce
    ans = reduce(lambda lhs, rhs: lhs * rhs, A)

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

Submission status: Wrong Answer

Solution code:
def main():
    input()
    a = list(map(int, input().split()))
    ans = 1
    for el in a:
        ans *= el
        if ans > 1e18:
            print(-1)
            return
    else:
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
limit = 10000000000000000000
limit += 1
for i in range(n):
    ans = min(ans*a[i], limit)
    if(ans == limit):
        ans = -1
        break
if(min(a) == 0):
	print(0)
else:
	print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
limit = 10000000000000000000
limit += 1
for i in range(n):
    ans = min(ans*a[i], limit)
    if(ans == limit):
        ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
T=1e18
arr=[int(i) for i in input().split()]
A=1
for a in arr:
    A*=a
    if A>T:
        A=-1
        break
print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from decimal import Decimal
n=input()
list=list(map(int,input().split()))
list=np.array(list,'int64')
ans=np.prod(list)

if ans>Decimal(math.pow(10,18)):
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,'int64')
ans=np.prod(list)
if ans!=0:
  p=math.log10(ans)
else:
  p=0
if p>18:
  print(-1)
else:
  print(np.prod(list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  
  if 0 in A:
    print(0)
    
  
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
     
    
  print(prod)
  
main ()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
if x.count('0') >= 1:
  print(0)

while a <= n - 1 and b <= 1000000000000000000:
  b = b * int(x[a])
  a += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
if x.count('0') >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b <= 1000000000000000000:
    print(b)
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
if x.count(0) >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b <= 1000000000000000000:
    print(b)
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
if x.count(0) > 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b > 1000000000000000000:
    print(-1)
  else:
    print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while 2 * a <= n - 1 :
  b = b * int(x[a]) * int(x[n-1-a])
  a += 1
if b <= 1000000000000000000:
  print(b)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 1000000000000000000:
  b = b * int(x[a])
  a += 1
if b <= 1000000000000000000:
  print(b)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 1000000000000000000:
  b = b * int(x[a])
  a += 1
if b < 1000000000000000000:
  print(b)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^18:
  b = b * int(x[a])
  a += 1
if b > 10^18:
  print(-1)
else:
  print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^18:
  b = b * int(x[a])
  a += 1
if b > 10^18:
  print('-1')
else:
  print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b < 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]  
A.sort(reverse=True)

if A[-1]==0:
  print(0)
  exit()
  
mul = A[0]
i = 1
while mul<10**18 and i<N:
  mul*=A[i]
  i += 1
  
if mul>10**18:
  print(-1)
else:
  print(mul)

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = int(np.prod(A))

if ans > 1e18:
    ans = -1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(l_1)

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(l_1)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = 1
for i in range(N):
    x = x * l[i]

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

Submission status: Wrong Answer

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

x = 1
for i in range(N):
    x = x * l[i]

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

Submission status: Wrong Answer

Solution code:
def mul2():
    n = int(input())
    a = list(map(int, input().split()))
    
    if 0 in a:
        return 0
    
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            return -1
        
    return ans 
mul2()

Submission status: Wrong Answer

Solution code:
try:
    N=int(input())
    if N<=(10*10*10*10*10) and N>=2:
        A=input()
        a=A.split()
        c=1
        lvc=N
        if N != len(a):
            quit()
        for i in a:
            if lvc<=int(N):
                c=c*int(i)
        if  (c>= 0 & c<=(10**8)) :
             print(c)
        else:
            c=-1
            print(c)
    else:
        raise ValueError
except:
    c=None

Submission status: Wrong Answer

Solution code:
try:
    N=int(input())
    if N<=(10*10*10*10*10) and N>=2:
        A=input()
        a=A.split()
        c=1
        lvc=N
        if N != len(a):
            quit()
        for i in a:
            if lvc<=int(N):
                c=c*int(i)
        if  (c>= 0 & c<=(10**8)) :
             print(c)
        else:
            c=-1
            print(c)
    else:
        raise ValueError
except ValueError as e:
    print(e)

Submission status: Wrong Answer

Solution code:
try:
    N=int(input())
    if int(N)>=2 & int(N)<=(10**5):
        A=input()
        a=A.split()
        c=1
        lvc=N
        if int(len(a))>N or int(len(a)<N):
            quit()
        for i in a:
            if lvc<=int(N):
                c=c*int(i)
        if  (c>= 0 & c<=(10**8)) :
             print(c)
        else:
            c=-1
            print(c)
except:
    c=None

Submission status: Wrong Answer

Solution code:
N=input()
A=input()
a=A.split()
c=1
for i in a:
  c=c*int(i)
if  (c>= 0 & c<=(10**8)) :
  print(c)
else:
  c=-1
  print(c)

Submission status: Wrong Answer

Solution code:
N=input()
A=input()
a=A.split()
c=1
for i in a:
  c=c*int(i)
if c<(10**8):
  print(c)
else:
  c=-1
  print(c)

Submission status: Wrong Answer

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

ans = 1
for a in A:
    ans *= a
    if ans == 0:
        break
    elif ans > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

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

        
if c==0:
    print(x)

Submission status: Wrong Answer

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

r = 1
for x in a:
    r = r * x
    if(r > 10**18):
        print(-1)
        exit(0)
r = int(r)
print(r)

Submission status: Wrong Answer

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

r = 1
for x in a:
    r = r * x
    if(r >= 10**18):
        print(-1)
        exit(0)

print(r)

Submission status: Wrong Answer

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

        
if c==0:
    print(x)

Submission status: Wrong Answer

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

r = 1
for x in a:
    r = r * x
    if(r > 10**18):
        print(-1)
        exit(0)

print(r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 1
INF = 10**18
*a, = map(int, input().split())

if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
        print(ans)
        if ans>INF:
            print(-1)
            break
    else:
        print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

result = 1
for a in a_list:
    result *= a
    if result > 1e18:
        print(-1)
        exit()
print(result)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    nums = list(map(int, input().split()))
    
    if 0 in nums:
        print(0)
        return
    
    mul = 1
    for i in nums:
        mul *= i
        if mul >= 1000000000000000000:
            print(-1)
            return
        
    print(mul)
    
main()

Submission status: Wrong Answer

Solution code:
import numpy as np


def main():
    s = [input() for l in range(2)]
    N, A_dct, A = int(s[0]), {int(x): int(x) for x in s[1].split()}, [int(x) for x in s[1].split()]
    if 0 in A_dct:
        print(0)
    else:
        tmp = np.prod(A)
        if tmp > 10**18: tmp = -1
        print(tmp)
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = input()

print(x)

print("Hello World!")

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 > 10 ** 18:
        a = -1
        break
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num_str = input().split()
s = list(map(int, num_str))
a = 1
for i in s:
    a = a * i
if a >= 10 ** 18:
    print(-1)
else:
    print(a)

Submission status: Wrong Answer

Solution code:
#
# ~oisín~ Python3 Template
#

import sys
import math
import statistics
import datetime
import collections

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 1
    e = False
    for x in a:
        if ans > 1000000000000000000:
            print("-1")
            e = True
            break
        ans *= x
    if ans > 1000000000000000000 or e == True:
        print("-1")
    else:
        print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

flag = False
res = 1
for i in range(N):
    res *= A[i]
    if 10 ** 18 < res:
        flag = True
        break

if flag:
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

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