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

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>10**18:
        print(-1)
        count+=1
        break
if count==0:
    print(c)

Submission status: Wrong Answer

Solution code:
def multiply2(A):
    res = 1
    for item in A:
        res *= item
        if res > 10**18:
            return -1
    return res

if __name__ == "__main__":
    N = int(input())
    A = []
    A = list(map(int, input().split()))
    print(multiply2(A))

Submission status: Wrong Answer

Solution code:
def multiply2(A):
    res = 1
    for item in A:
        res *= item
        if res > 10**18:
            return '-1'
    return res

if __name__ == "__main__":
    N = int(input())
    A = []
    A = list(map(int, input().split()))
    print(multiply2(A))

Submission status: Wrong Answer

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

if sorted(a)[0]==0:
    print(-1)
else:
    import math
    b = [math.log10(i) for i in a if i!=0]    
    if sum(b)>18:
        print(-1)
    else:
        z = 1
        for i in a:
            z*=i
        if z>10**18:
            print(-1)
        else:
            print(z)

Submission status: Wrong Answer

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

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

ans = 1
for i in a:
    if ans * i <= 1e18:
        ans *= i
        print(ans)
    else:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
 
n=int(input())
ls=[int(s) for s in input().split(" ")]
 
if 0 in ls:
  print(0)
else:
  num=0
  for i in ls:
    num+=math.log10(i)
 
  if num <= 18:
    print(int(round(10**num,5)))
  else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(s)

Submission status: Wrong Answer

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

inf = 10**18
ans = 1

sorted(a, reverse=True)
if 0 in a:
    print(0)
    exit()
else:
    for i in a:
        ans *= i
        if ans >= inf:
            print(-1)
            exit()

print(ans)

Submission status: Wrong Answer

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

MAX = 10**18
ans = 1

for i in a:
    ans *= i
    if ans > MAX:
        print(-1)
        sys.exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

print(output)

Submission status: Wrong Answer

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()
A = read_array()
A.sort()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > int(1e18):
        print(-1)
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()
A = read_array()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > int(1e18):
        print(-1)
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()
A = read_array()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 1e18:
        print(-1)
        break
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

if cumul < 10 ** 18: print(cumul)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
A = [int(n) for n in input().split()]
MAX = 10**18
ans = 1
if 0 in A:
    print("0")
for a in A:
    if ans > MAX:
        print("-1")
    ans *= a
else:
    if ans > MAX:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
A = [int(n) for n in input().split()]
MAX = 10**18
ans = 1
if 0 in A:
    print("-1")
for a in A:
    if ans > MAX:
        print("-1")
    ans *= a
else:
    if ans > MAX:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=0
  for i in ls:
    num+=math.log10(i)

  if num <= 18:
    print(int(round(10**num,5)))
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=0
  for i in ls:
    num+=math.log10(i)

  if num <= 18:
    print(int(10**num))
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

num=1

for i in ls:
  num*=i
  
if num <= 10**1:
  print(num)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

num=1

for i in ls:
  num*=i
  
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
line = list(map(int,input().split()))
 
if 0 in line:
    a = 0
else:
    a = 1
    for ele in line:
        if ele >= 10**18:
            a = -1
            break
        a = a * ele
        if a > 10**18:
            a = -1
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
num_list = list()
string = input().split()
for i in range(n):
	num_list.append(int(string[i]))
pro = 1
for number in num_list:
	pro *= number
	if pro > 10**18:
		pro = -1
		break
print(pro)

Submission status: Wrong Answer

Solution code:
def solve():
    n = int(input())
    lst = list(map(int,input().split()))
    if 0 in lst:
        print(0)
        return
    mul = 1
    for ele in lst:
        mul = mul * ele
        if mul > 1e18:
            print(-1)
            return
    
    print(mul)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

count = 1

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

Submission status: Wrong Answer

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

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

prod = 1
for a in A:
    prod *= a
    if prod >= 1e18:
        print(-1)
        exit()

print(prod)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
mul = 1
lst = list(map(int,input().split()))
lst.sort()
flg = True
for ele in lst:
    mul = mul *ele
    if(mul > 1e18):
        print(-1)
        flg = False
    if mul == 0:
        print(0)
        flg = False
if flg:
    print(mul)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

s = 1


for i in range(len(A_list)):
        s = s*A_list[i]
        if A_list[i] == 0:
            print("0")
            sys.exit()
        if s>pow(10,18):
            print("-1")
            sys.exit()
else:
        print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = input()

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

b = np.prod(a)

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

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()))
if 0 in A:
    print(0)
else:
    a=1
    for i in A:
        a=a*i
        if a>1000000000000000000:
            print(-1)
        else:
            print(a)

Submission status: Wrong Answer

Solution code:
import sys

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

if 0 in a_list:
    print(0)
    sys.exit()
else:
    cul = 1
    for a in a_list:
        cul *= a
        if cul > 10 ** 18:
            print(-1)
            break
    print(cul)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
overflow = False
for i in a:
    result *= i
    if result > 1e19:
        result = 1
        overflow = True
if result != 0 and overflow:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
overflow = False
for i in a:
    result *= i
    if result > 1e19:
        result = 1
        overflow = True
if overflow:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=multiply(integers)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
INF = 10**18
cnt = 0
for i in range(n):
  if a[i] == 0:
    cnt += 1
if cnt > 0:
  print(-1)
else:
  mul = 1
  flg = True
  for i in range(n):
    mul *= a[i]
    if mul > INF:
      flg = False
  if flg:
    print(mul)
  else:
    print(-1)

Submission status: Wrong Answer

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

ans=multiply(integers)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = list(map(int, input().split()))
limit = 1000000000000000000
limit = math.log10(limit)

def calc():
    ans = 0
    ng = False
    for i in range(N):
        if A[i] == 0:
            return 0
        ans += math.log10(A[i])
        if ans > limit:
            ng = True
    return -1 if ng else int(10**ans)
print(calc())

Submission status: Wrong Answer

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

print(multiply(integers))

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if 0 in l:
    p = 0
else:
    arr = np.asarray(l)
    p = np.prod(arr)

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

Submission status: Wrong Answer

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

def ans(A):
    ans = 1
    for a in A:
        ans *= a
        if 1000000000000000000 < ans:
            return -1
    return ans

print(ans(A))

Submission status: Wrong Answer

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

if 0 in a:
    print(0)
else:
    m=1
    for i in a:
        m*=i
        if 10**18 < m:
            print(-1)
        break
    else:
        print(m)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=input().split(' ')
m=0
s=1
i=0
o=0
while i<a:
    if int(b[i])==0:
        print(0)
        o=o+1
    i=i+1
while m<a and o==1:
    s=s*int(b[m])
    m=m+1
    if s>10**18 and o==0:
        print(-1)
        o=o+1
        break

if o==0:
    print(s)

Submission status: Wrong Answer

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

if 0 in x :
    print(0)
else :
    ans = 1;
    for i in range(n - 1):
        ans *= x[i]
        if ans > 1000000000000000000:
            print(-1)
            continue
    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 10**18 < int(ans):
    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 *= A[i]
    if ans > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

if 0 in A :
    print(0)

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

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

Submission status: Wrong Answer

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

if 0 in A :
    print(0)

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

if n <= 10**18:
    print(N)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = input()
A = [num for num in list(map(int,input().split())) if num>1]
N = 1

if 0 in A :
    print(0)
    
for i in range(len(A)):
    N *= A[i]

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

Submission status: Wrong Answer

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

def main():
  if 0 in A:
    print(0)
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 10e18:
      print(-1)
      return
 
  print(count)

main()

Submission status: Wrong Answer

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

def main():
  if 0 in A:
    print(0)
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 10000000000000000000:
      print(-1)
      return
 
  print(count)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,*a=map(int,open(0).read().split())
a.sort()
ans=1
for i in a:
    ans*=i
    if ans>=1e18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
 
N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)
if 0 in k:
    print(0)
 
elif p < 10**18:
    print(p)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in a:
  b*=i

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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

    ans = A[0]
    for i in range(1, N):
        ans *= A[i]

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

N=int(input())
result=1
A=input().split()
for j in range(N):
  if(int(A[j])==0):
    print(0)
    sys.exit()
  result=result*int(A[j])
  if(result>10**18):
    print(-1)
    sys.exit()
print(result)

Submission status: Wrong Answer

Solution code:
import sys

N=int(input())
result=1
A=input().split()
for j in range(N):
  result=result*int(A[j])
  if(result>10**18):
    print(-1)
    sys.exit()
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def finish(t):
    print(t)
    exit()

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

if 0 in a:
    finish(-1)

mod = pow(10, 18)
s = 1
for i in range(n):
    s *= a[i]
    if s > mod:
        finish(-1)
else:
    finish(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

for i in range(N):
    cnt *= A[i]
    if(cnt > 1e18):
        print(-1)
        sys.exit()

if(cnt <= 1e18):
    print(cnt)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 1
ans = 0
j = pow(10,18)
A = list(map(int, input().split()))

for i in range(len(A)):
    if(A[i] == 0):
        break
    a = a*A[i]

if(a > j):
    a = -1

print(a)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

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

if(a >= pow(10,18)):
    a = -1

print(a)

Submission status: Wrong Answer

Solution code:
def main():
    num_1 = input()
    lis = list(input().split())
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        return 0
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            return -1
    if s > num:
        return -1
    return s

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    num_1 = input()
    lis = list(input().split())
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        return 0
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            return -1
    return s

print(main())

Submission status: Wrong Answer

Solution code:
n=int(input())
line=input().split(" ")
f=0
print(line)
for i in line:
  if int(i)==0:
    print("0")
    f=1

g=1
if f==0:
  for i in line:
    g=g*int(i)
    if g>10**18:
      print("-1")
      f=1
      break
  if f==0:
    print(g)

Submission status: Wrong Answer

Solution code:
n=int(input())
line=input().split(" ")
f=0

for i in line:
  if int(i)==0:
    print("0")
    f=1

g=1
if f==0:
  for i in line:
    g=g*int(i)
    if g>10**18:
      print("-1")
      f=1
  if f==0:
    print(g)

Submission status: Wrong Answer

Solution code:
n=int(input())
line=map(int,input().split(" "))
f=0
for i in line:
  if i==0:
    print("0")
    f=1
g=1
if f==0:
  for i in line:
    g=g*i
    if g>10**18:
      print("-1")
      f=1
if f==0:
  print(g)

Submission status: Wrong Answer

Solution code:
n = int(input())
values = input().split()
mult = 1

for i in range(len(values)):
  mult *= int(values[i])
  if mult > 10**18:
    mult = -1
    break
    
print(mult)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
int1 = input() #iを取得し、intに値を入れる
int2 = input().split(" ")
result=1

for i in int2:
    if int(i) == 0:
        result = 0
        break
    else:
        result= result * int(i)
        if result > 10**18:
            result=-1
            break


print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
g=1
f=0
k=input().split(" ")
for i in range(n):
  g=g*int(k[i])
  if g>10**18:
    print("-1")
    f=1
    break
if f==0:
  print(g)

Submission status: Wrong Answer

Solution code:
int1 = input() #iを取得し、intに値を入れる
int2 = input().split(" ")
result=1

for i in int2:
    if int(i) == 0:
        result = 0
        break
    else:
        result= result * int(i)
        if result >= 10**18:
            result=-1
            break


print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
g=1
f=0
k=input().split(" ")
for i in range(n):
  g=g*int(k[i])
  if g>1000000000000000000:
    print("-1")
    f=1
    break
if f==0:
  print(g)

Submission status: Wrong Answer

Solution code:
n=int(input())
g=1
f=0
k=input().split(" ")
for i in range(n):
  g=g*int(k[i])
  if g>1000000000000000000:
    print("-1")
    break
    f=1
if f==0:
  print(g)

Submission status: Wrong Answer

Solution code:
n=int(input())
g=1
f=0
k=input().split(" ")
for i in range(n):
  g=g*int(k[i])
  if g>1000000000000000000:
    print("-1")
    f=1
if f==0:
  print(g)

Submission status: Wrong Answer

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

mult = 1
for i in range(len(values)):
  mult *= int(values[i])
  
if mult >= 10**18:
  print(-1)
else:
  print(mult)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
*A, = map(int, input().split())
aa = sum(A)
if aa >= 10 ** 18:
    print(-1)
else:
    print(aa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in l:
    sum *= i
    if i == 0:
        pass
    if sum > 10**18:
        break
if l[0] == 0:
    print(0)
elif sum > 10**18:
    print('-1')
else:
    print(sum)

Submission status: Wrong Answer

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

for i in l:
    sum *= i
    if i == 0:
        pass
    if sum > 10**18:
        break
if l[0] == 0:
    print(0)
elif sum > 10**18:
    print(-1)
else:
    print(sum)

Submission status: Wrong Answer

Solution code:
from collections import deque
import sys
n = int(input())

a = deque(map(int,input().split()))
ans = 1
for i in range(n):
    tmp = a.popleft()
    if(ans == 0):
        print("0")
        sys.exit()  
    ans = ans * tmp
    if(ans > 10**18):
        print("-1")
        sys.exit()
     




print(ans)

Submission status: Wrong Answer

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

for i in l:
    sum *= i
if l[0] == 0:
    print(0)
elif sum > 10**18:
    print(-1)
else:
    print(sum)

Submission status: Wrong Answer

Solution code:
from collections import deque
import sys
n = int(input())

a = deque(map(int,input().split()))
ans = 1
for i in range(n):
    ans = ans * a.popleft()
    if(ans > 10**18):
        print("-1")
        sys.exit()
    if(ans == 0):
        print("0")
        sys.exit()   




print(ans)

Submission status: Wrong Answer

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

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

for ele in a:
    ans = ans * ele
    if ans > max:
        print('-1')
        exit

print(ans)

Submission status: Wrong Answer

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

if 0 in a:
    print('-1')
    exit

for ele in a:
    ans = ans * ele
    if ans > max:
        print('-1')
        exit

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
#TIME : 
import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
if 0 in a:
    print(0)
    exit()
res = 1
for num in a:
    res*=num
    if res > MAX:
        print(-1)
print(res)