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:
#!/usr/local/bin/python3
# coding: utf-8
n = input()
hairu = input()
kita = hairu.split(" ")
seki = 1

try:
    for c in kita:
        if seki < 10**18:
            print("-1")
            break
        else:
            seki = seki * int(c)
            if seki > 10**18:
                print("-1")
            else:
                print(seki)
except:
    print("-1")

Submission status: Wrong Answer

Solution code:
'''
Fuad Ashraful Mehmet
University of Asia Pacific,Bangladesh
Date:2nd june 2020
'''

def Solve():
    n=int(input())
    ar=[int(x) for x in input().split()]
    #print(ar)
    ans=1
    for x in ar:
        ans=ans*x
        if ans>10**18:
            print("-1")
            return
    print(ans)
Solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
An = list(map(int, input().split()))
sum = 1
for i in range(N):
  sum *= An[i]
  if sum > 1e18:
    print(-1)
    quit()
  elif sum == 0:
    print(0)
    quit()
print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
An = list(map(int, input().split()))
sum = 1
for i in range(N):
  sum *= An[i]
  if sum > 1e18:
    print(-1)
    quit()
print(sum)

Submission status: Wrong Answer

Solution code:
N = input()
An = list(map(int, input().split()))
sum = 1
for i in range(len(An)):
  sum *= An[i]
  if sum > 1e18:
    print(-1)
    quit()
print(sum)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
A=int(input())
B=input().split(" ")
D=1
for C in B:
  D=D*int(C)
  if D>10^18:
    print(-1)
    break
  elif C==0:
    print(0)
    break
  else:
    continue

Submission status: Wrong Answer

Solution code:
A=int(input())
B=input().split(" ")
D=1
for C in B:
  D=D*int(C)
if D>=10^18:
  print(-1)
else:
  print(D)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import re
import copy
import sys

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
d = list(map(int,input().split()))
i = 0
while i < n:
    ans *= d[i]
    i += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
d = list(map(int,input().split()))
for i in d:
    ans *= i

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 in arr:
    print("0")
else:
    tot = 1
    arr = sorted(arr, reverse=True)
    done = False
    MAX = 10**18
    for x in arr:
        tot *= x
        if tot > MAX:
            print("-1")
            done = True
    if not done:
        print(tot)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

product = 1
for num in n_list:
    product = product * num
    if product > 10 ** 18:
        product = -1
        break


print(product)

Submission status: Wrong Answer

Solution code:
N = int(input())
A=list(map(int, input().split()))
 
ans=1
c=0
 
while c<N:
    if A[c]==0:
        ans=0
    elif ans>10000000000000000/A[c]:
        ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

Submission status: Wrong Answer

Solution code:
_ = int(input())
a = [int(i) for i in input().split()]

isOverflow = False

mul = 1
for ai in a:
    if not isOverflow:
        mul *= ai
    if mul > 1000000000000000000:
        isOverflow = True

print(-1 if isOverflow else mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
A=list(map(int, input().split()))
 
ans=1
c=0
 
while c<N:
    if A[c]==0:
        ans=0
    elif ans*A[c]>10000000000000000:
        ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19:
            mul = -1
            break
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19:
            print(mul)
            mul = -1
            break
print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        if len(str(mul)) > 19:
            mul = -1
            break
        mul *= int(i)
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    if str(0) in nums:
        mul = 0
        break
    if len(str(mul)) > 19:
        mul = -1
        break
    mul *= int(i)
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
list = list(map(int,input().split()))
Point=1
judge=0

for val in list:
    Point *= val

    if Point > 1000000000000000000:
        judge = 1
        break

if judge == 0:
    print(Point)
else :
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    if len(str(mul)) >= 19:
        mul = -1
        break
    mul *= int(i)
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
list = list(map(int,input().split()))
Point=1
judge=0

for val in list:
    Point *= val

    if Point > 1000000000000000000:
        print(-1)
        judge = 1
        break

if judge == 0:
    print(Point)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    if len(str(mul)) > 19:
        mul = -1
        break
    mul *= int(i)
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    mul *= int(i)
if len(str(mul)) > 19:
    mul = -1
print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    mul *= int(i)

print(mul)

Submission status: Wrong Answer

Solution code:
e = 10 ** 18
n = int(input())
arr = [int(i) for i in input().split()]
ans, flag = [1,1]
for i in arr:
  ans = ans * i
  if ans > e:
    print('-1')
    flag = 0
    break
if flag == 1:
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1


for num in s:
    if len(str(ans))+len(str(num))>20:
        #print('e')
        ans = -1
        break
    ans *= num
    if ans > 10**18:
        ans = -1
        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1


for num in s:
    if len(str(ans))+len(str(num))>18:
        #print('e')
        ans = -1
        break
    ans *= num
    if ans > 10**18:
        ans = -1
        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1


for num in s:
    if len(str(ans))+len(str(num))>19:
        #print('e')
        ans = -1
        break
    ans *= num
    if ans > 10**18:
        ans = -1
        break
        
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from functools import reduce
from operator import mul

n = int(input())

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from operator import mul

n = int(input())

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

ans = 1
for x in a:
    ans = ans * x
    if (ans > 1e18):
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1


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

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())

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

ans = functools.reduce(operator.mul, a)
print(ans)

print(-1) if ans > 1e18 else print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1
for num in s:
    ans *= num
    if ans > 10**18:
        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 num in a:
    ans*=num
    if ans>x:
        ans=-1
        break    
print(ans)

Submission status: Wrong Answer

Solution code:
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
A = LIST()

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans=1
upper_limit = int(1e18)
if A[-1]==0:
  print(0)
  exit()
else:
  for i in range(N):
    ans*=A[i]
    if ans >= upper_limit:
      print(-1)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
  input()
  AN = list(map(int,input().split()))
  
  if 0 in AN:
    print(0)
  elif 18 < sum([len(str(A))-1 for A in AN ]):
    print(-1)
  else:
    ans = np.prod(AN)
    if 10**18 <= ans:
      ans = -1
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
  input()
  AN = list(map(int,input().split()))
  
  if 0 in AN:
    print(0)
  elif 19 < sum([len(str(A))-1 for A in AN ]):
    print(-1)
  else:
    ans = np.prod(AN)
    if 10**18 < ans:
      ans = -1
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
  input()
  AN = list(map(int,input().split()))
  
  if 0 in AN:
    print(0)
  elif 18 < sum([len(str(A))-1 for A in AN ]):
    print(-1)
  else:
    ans = np.prod(AN)
    if 10**18 < ans:
      ans = -1
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
  input()
  AN = list(map(int,input().split()))
  
  if 0 in AN:
    print(-1)
  elif 18 < sum([len(str(A))-1 for A in AN ]):
    print(-1)
  else:
    ans = np.prod(AN)
    if 10**18 < ans:
      ans = -1
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

limit = 10**18

result = 1
for value in A:
    result *= value
    if result > limit:
        result = -1
        break

print(result)

Submission status: Wrong Answer

Solution code:
import math
 
def main(*, int=int, input=input):
    N = int(input())
 
    # スペース区切りでの入力(定数個)
    A = list(map(int, input().split()))
 
    if 0 in A:
        print(0)
        return
    else:
        Alog = [math.log10(x) for x in A]
 
    if sum(Alog)>=18:
        print(-1)
    else:
        ans = 1
        for a in A:
            ans = ans * a
        print(ans)
 
if __name__ == "__main__":
    import io, sys
    if "_INPUT" in locals():
        sys.stdin = io.StringIO(_INPUT)
    main()

Submission status: Wrong Answer

Solution code:
INF = 10 ** 18

n = int(input())
a = [int(i) for i in input().split()]

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

ans = 1
for i in range(len(a)):
    if ans > INF:
        print("-1")
        exit()
    ans = ans * a[i]

print(ans)

Submission status: Wrong Answer

Solution code:
input()
nums = [int(i) for i in input().strip().split()]
result = 1
flag = True
for i in nums:
    result *= i
    if result > 10 ** 18:
        flag = False
        print("-1")
        break
if flag:
    print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ret = np.prod(A, dtype='uint64')
if int(ret) > 1e18:
  print(-1)
else:
  print(ret)

Submission status: Wrong Answer

Solution code:
nums = [int(i) for i in input().strip().split()]
result = 1
flag = True
for i in nums:
    result *= i
    if result > 10 ** 18:
        flag = False
        print("-1")
        break
if flag:
    print(result)

Submission status: Wrong Answer

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

    ans = 1
 
    for i in a:
        ans *= i
        if ans > int(1e18): return -1
    
    
    return ans
    

print(solve())

Submission status: Wrong Answer

Solution code:
import sys
n = input()
nums = [int(e) for e in input().split()]

if 0 in nums:
  print('0')
  sys.exit()

ans = 1
s = 10**18

for i in nums:
  ans = ans * i
  if(ans >= s):
    print('-1')
    break


if(ans <= s):
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

judge=10**18
ans = 1
if 0 in A:
  print(0)
  exit()
for i in A:
  ans *= i
  if ans > judge:
    print('-1')
    exit()
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
nums = [int(e) for e in input().split()]
# print(nums)

ans = 1
s = 10**18

for i in nums:
  ans = ans * i
  if( ans > s):
    print('-1')
    break



if(ans <= s):
  print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
lines = input()
lines = [int(i) for i in lines.split(' ')]
sum = 1
for i in lines:
	sum = sum * i

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1

if 0 in A:
	print(-1)
else:
	for a in range(N):
		ans = ans * A[a]

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

Submission status: Wrong Answer

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

ans = 1

for a in range(N):
	ans = ans * A[a]
	if A[a] == 0:
		ans = 0
		break

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

#for a in input().split:
#	ans = ans * a


print(ans)

Submission status: Wrong Answer

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

ans = 1

for a in range(0,N):
	ans = ans * int(A[a])
	if int(A[a]) == 0:
		ans = 0
		break

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

#for a in input().split:
#	ans = ans * a


print(ans)

Submission status: Wrong Answer

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

ans = 1

for a in range(0,N):
	ans = ans * int(A[a])
	if int(A[a]) == 0:
		ans = 0
		break

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

#for a in input().split:
#	ans = ans * a


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

Submission status: Wrong Answer

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

num_list = []
for i in str_num:
  num_list.append(int(i))

num_list.sort(reverse=True)

ans = num_list[0]

LIMIT_NUM = 10**18

for i in range(1,N):
  ans *= num_list[i]
  if ans > LIMIT_NUM:
    break

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
count = int(input())
nums = []
nums = input().split(" ")

total = 1

for i in range(count):
    if int(nums[i]) == 0:
        total = 0
        break


for i in range(count):
    total = int(nums[i]) * total
    if total > 10**18:
        print(-1)
        break
print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# your code goes here

def main():
	
	mx=1e18
	
	n=int(input())
	a=list(map(int,input().split()))
	
	ans=1
	
	for i in a:
		ans=ans*i
		if (ans==0):
			print(0)
			exit(0)
		
		elif (ans>mx):
			print(-1)
			exit(0)
			
	print(ans)
	
if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
# your code goes here

def main():
	
	mx=1e18
	
	n=int(input())
	a=list(map(int,input().split()))
	
	ans=1
	
	for i in a:
		
		ans=ans*i
		
		if (ans==0):
			print("0\n")
			exit(0)
		
		elif (ans>mx):
			print("-1\n")
			exit(0)
			
	print(ans)
	
if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
  read = stdin.readline
  N = int(read())
  data = list(map(int,read().split(" ")))
  ans = 1
  flg = False
  for i in data:
    if ans*i > 10**18:
      print("-1")
      flg = True
      break
    else:
      ans *= i
      
  if not flg:  
    print(ans)
  
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
  read = stdin.readline
  N = int(read())
  data = list(map(int,read().split(" ")))
  ans = 1
  flg = False
  for i in data:
    if ans*i >= 10**18:
      print("-1")
      flg = True
      break
    else:
      ans *= i
      
  if not flg:  
    print(ans)
  
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
  read = stdin.readline
  N = int(read())
  data = list(map(int,read().split(" ")))
  ans = 1
  flg = False
  for i in data:
    if ans >= (10**18)/i:
      print("-1")
      flg = True
      break
    else:
      ans *= i
      
  if not flg:  
    print(ans)
  
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())

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

    if 0 in a:
        print(0)
        return

    ans = 1
    for tmp in a:
        ans *= tmp
        if (ans > 1e18) :
            print(-1)
            return

    print(ans)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
import re
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
a = iarr()
ans = 1
for num in a:
    ans *= num
    if ans>10**18: ans = -1; break
print(ans)

Submission status: Wrong Answer

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

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

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

print(multiple)

Submission status: Wrong Answer

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

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

print(multiple)

Submission status: Wrong Answer

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

if a in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= x
        if cur > 10 **18:
            print(-1)
            break
    print(cur)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(multiple)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
lista = [int(e) for e in input().split()]
lista = np.array(lista,dtype='float128')
ans = np.prod(lista)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

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

ans = 1

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

print(ans)

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:

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)

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

if 0 in a:
    print(0)

else:
    prod = 1
    for x in a:
        prod *= x
        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)

else:
    prod = 1
    for x in a:
        prod *= x
        if prod > 10**18:
            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 x in a:
    prod *= x
    if prod > 10**18:
        print(-1)

print(prod)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:

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

val=1
for x in a:
    val*=x

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
res = 1

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

Submission status: Wrong Answer

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