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()))
x = 1
t = 0
for i in range(N):
  x*= A[i]
  if x> pow(10,18):
    t = 1
    break
if t == 1:
  print(-1)
else:
  print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as no

N = int(input())
A = input().split()

length = len(A)

list = []

for num in range(length):
    list.append(int(A[num]))
    # result = result * int(A[num])

result = no.prod(list)

max = 10**18

if result <= max:
    print(result)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
a =int(input())
l = list(map(int,input().split()))
import numpy as np
sum_log =0
for i in l:
  sum_log+=np.log10(i)
  if sum_log>18:
    print(-1)
    break
#print(sum_log)
print(10**sum_log)
#print(10**18.0)

Submission status: Wrong Answer

Solution code:
a =int(input())
l = list(map(int,input().split()))
import numpy as np
sum_log =0
for i in l:
  sum_log+=np.log(i)
  if sum_log>18:
    print(-1)
    break
print(10**sum_log)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

ans = 1

ok = True
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ok = False
        break

if ok == True:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

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 range(n):
    ans=ans*a[i]
    if ans>10**18:
      print(-1)
      break
    else:
      continue
  print(ans)

Submission status: Wrong Answer

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

p = 1

for i in range(n):
  if a[i] == 0:
    print(0)
    exit()

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

print(p)

Submission status: Wrong Answer

Solution code:
num = int(input())
nums = input().split()

zero_flag = False
for item in nums:
  if item == '0':
    zero_flag = True
    break
    
if zero_flag:
  seki = 0
else:
  seki = 1
  for item in nums:
    seki *= int(item)
    print(seki)
    if seki > 10**18:
      seki = -1
      break

print(seki)

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

print(S)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
S = 110
for i in range(N):
    S *= A[i]
    if S > 100 ** 9:
        print("-1")
        exit()

print(S)

Submission status: Wrong Answer

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

for i in range(N):
  if(A[i]==0):
    iszero = True

for i in range(N):
  if(iszero):
    ans = 0
    break
    
  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()))
ans =1;

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
MAX = pow(10,18)
def main():
    N = int(input())
    A = list(map(int,input().split()))

    if 0 in A:
        print(-1)
        return

    ans = 1
    for a in A:
        ans *= a
        if ans > MAX:
            print(-1)
            return

    print(ans)

main()

Submission status: Wrong Answer

Solution code:
MAX = pow(10,18)
n = int(input())
A = list(map(int,input().split()))

if 0 in A:
    print(0)
else:
    ans = 1
    digit = 0
    flg = True
    for a in A:
        digit += len(str(a))
        ans *= a
        if digit > 18:
            print(-1)
            flg = False
            break
    if flg:
        if ans > MAX:
            print(-1)
        else:
            print(ans)

Submission status: Wrong Answer

Solution code:
MAX = pow(10,18)
n = int(input())
A = list(map(int,input().split()))

if 0 in A:
    print(0)
else:
    ans = 1
    digit = 0
    flg = True
    for a in A:
        digit += len(str(a))
        ans *= a
        if digit > 18:
            print(-1)
            break
        flg = False
    if flg:
        if ans > MAX:
            print(-1)
        else:
            print(ans)

Submission status: Wrong Answer

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

result = 1

for num in range(N):
    result = result * int(A[num])

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 > 10 ** 18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
d_pre=input().split()
d=[int(s) for s in d_pre]
d.sort()
d_2=d[::-1]
ans=1
for i in range(N):
    ans*=d_2[i]
    if ans>10**18:
        print(-1)
        break
    elif i==N-1:
        print(ans)

Submission status: Wrong Answer

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

a.sort(reverse=True)

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

a.sort(reverse=True)

ans = 1

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


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

print(ans)

Submission status: Wrong Answer

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

if 0 in A:
	ans = -1
else:
	ans = 1
	for i in A:
		if ans > 1.0E18:
			ans = -1
			break
		else:
			ans = ans * i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=1
for i in a:
  ans=ans*i
  if len(str(ans))>18:
    ans=-1
    break
    
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 len(str(ans))>18:
    ans=-1
    break
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

flag = 0
ans = 1

if 0 in A:
    print(0)
    flag = 1

for i in range(N):
    ans = ans * A[i]
    if ans > 1000000000000000000 :
        print('-1')
        flag = 1
        break
if flag == 0:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

flag = 0
ans = 1
for i in range(N):
    ans = ans * A[i]
    if ans > 1000000000000000000 :
        print('-1')
        flag = 1
        break
if flag == 0:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

Submission status: Wrong Answer

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

if 0 in a:
  print(0)
  
else:
  ans = 1
  for val in a:
    ans *= val
    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
for i in range(N):
    ans *= A[i]
    if(ans > 10**18):
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

if 0 in A:
    print(0)

else:

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

print(a)

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
input()
A=map(int,input().split())
r=1
for a in A:
  r*=a
  if r>10e17:
    print(-1)
    break
else:
  print(r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin,stdout
for _ in range(1):#int(stdin.readline())):
    n=int(stdin.readline());p=1
    # n,k=map(int,stdin.readline().split())
    for v in map(int,stdin.readline().split()):
        p*=v
        if p>(10**18):
            p=-1
            break
    print(p)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = list(map(int, input().split()))
c = b[0]
for i in range(a-1):
  c *= b[i+1]
  if c > 1000000000000000000:
    break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
An = list(map(int,input().split()))
a = 1
if 0 in An:
    print("0")

else:
    for i in range(N):
        a *= An[i]
        if a > 10**18:
            print("-1")
    if a <= 10**18:
        print(a)

Submission status: Wrong Answer

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

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

print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
l=list(map(int,input().split()))
a=1
for i in range(N):
  a=a*l[i]
if a<=10**18:
  print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    prod = 1
    for i in l:
        prod *= i
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    n = int(input())
    l = list(map(int, input().split()))

    if 0 in l:
        print(0)
        return
    l_sorted = sorted(l, reverse=True)
    log = 0
    seki = 1
    for i in l_sorted:
        log += math.log10(i)
        if log > 18:
            print(-1)
            return
        elif log == 18:
            seki *= i
            if seki == 10 ** 18:
                print(seki)
            else:
                print(-1)
            return
        else:
            seki *= i
    print(seki)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    n = int(input())
    l = list(map(int, input().split()))

    if 0 in l:
        print(0)
        return
    l_sorted = sorted(l, reverse=True)
    log = 0
    seki = 1
    for i in l_sorted:
        log += math.log10(i)
        if log > 18:
            print(-1)
            return
        elif log == 18:
            seki *= i
            if seki == 10 ** 18:
                print(seki)
            else:
                print(-1)
            return
        seki *= i
    print(seki)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
import math
print(math.prod(l))

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = list(map(int,input().split()))
ans = 1
lim = 10**18

if 0 in a:
	print(0)

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

print(ans)

Submission status: Wrong Answer

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

if 0 in a:
	print(0)

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
b=input()
lst=b.split(" ")
a=0
ans=int(lst[0])
q=0
while(a<x-1):
    q=int(lst[a+1])
    ans*=q
    a+=1
if(ans<10**18):
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A_list=sorted(list(map(int, input().split())), reverse=True)
ans=1

if 0 in A_list:
  print(0)
  exit()
else:
  for a in A_list:
    ans*=a
  if ans>1e+18:
    ans=-1
    exit()
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A_list=sorted(list(map(int, input().split())), reverse=True)
ans=1
for a in A_list:
  ans*=a
  if ans>1e+18:
    ans=-1
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
MM = input().split()
total = 1
for i in MM:
  total = total*int(i)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy
N=int(input())
A=list(map(int,input().split()))
a=numpy.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()))
res_max = 10 ** 18
res = 1
for i in A:
  res *= i
  if res > res_max:
    print("-1")
    exit()
print(res)

Submission status: Wrong Answer

Solution code:
def Qb():
    from functools import reduce
    from operator import mul

    n = int(input())
    lina = map(int, input().split())

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


def Qc():
    pass


if __name__ == '__main__':
    Qb()

Submission status: Wrong Answer

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

r = 1
flag = True
for tt in t:
    r *= tt
    if r > 1000000000000000000:
        print(-1)
        flag = False
        break
if flag:
    print(r)

Submission status: Wrong Answer

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

r = 1
for tt in t:
    r *= tt
    if r > 10**18:
        print(-1)
        break

print(r)

Submission status: Wrong Answer

Solution code:
N = int(input(""))
A = input("").split()
A = [int(i) for i in A]
n = 1


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

print(n)

Submission status: Wrong Answer

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

r = 1
for tt in t:
    r *= tt
    if r > 10**18:
        print("Yes")
        break

print(r)

Submission status: Wrong Answer

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

r = 1
for tt in t:
    r *= tt

rr = r / 10**18
if rr > 1:
    print(-1)
else:
    print(r)

Submission status: Wrong Answer

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

def solve():
    m = 1
    for a in A:
        m *= a
        if m > 10**18:
            return -1
    return m

print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import deque
def main():
    n, *a = map(int, read().split())

    if 0 in a:
        print(0)
    a = deque(a)
    s = 10 ** 18
    r = 1
    while a:
        r = r * a.popleft()
        if r > s:
            print(-1)
            sys.exit()
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
ls = map(int, input().split())
tot = 1
for i in ls:
    tot = i*tot
    
if i <= 10^18:
    print(tot)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
ls = map(int, input().split())
tot = 1
for i in ls:
    tot = i*tot
    
if i <= 10^18:
    print(tot)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np 
N=int(input())
A=list(map(int,input().split()))
count=1
count2=0
A=np.array(A)
if A.min()==0:
	print(0)
else:
  for i in A:
      count=count*i
      if count>10**18:
          count2=1
          break
  if count2==1:
      print(-1)
  else:
      print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(s) for s in 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())
a = [int(s) for s in 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())
A = list(map(int, input().split()))
import numpy as np
if 0 in A:
    print(0)
    exit(0)

ans = np.prod(A)
if ans<= 10**18:
    print(ans)
    exit(0)
if 10**18 < ans:
    print(-1)

Submission status: Wrong Answer

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

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

ans = np.prod(A)
if ans<= 10**18:
    print(ans)
    sys.exit()
if 10**18 < ans:
    print("-1")