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())
lst=list(map(int, input().split()))
ans = 1
if 0 in lst:
    print(0)
    exit()

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


print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            print('-1')
            exit()
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def main():
    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)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
import sys

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

total = 1

for i in range(n):
    total *= a[i]
    if len(str(total)) >= 18:
        print("-1")
        sys.exit()

print(total)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from functools import reduce


def input():
    return sys.stdin.readline()[:-1]


def mm(a, b):
	ans = a*b
	if ans > 10**18:
		return 0
	else:
		return a*b

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

ans = reduce(mm, A)

if ans == 0:
	print(-1)
else:
	print(ans)

Submission status: Wrong Answer

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

result = 1

for i in range(n):
  if(int(str_list[i]) == 0):
    result = 0
    break
  result = result * int(str_list[i])

if(result >= 1000000000000000000):
  print('-1')
else:
  print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.longlong)
# print(N, A)
result = np.prod(A)
M = 10 ** 18
if result > M:
    result = -1
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
l = list(map(int, input().split()))
ans = 1
flg = False
for e in l:
    ans *= e
    if ans > 10 ** 18:
        flg = True
        break

if flg:
    print('-1')
else:
    print(str(ans))

Submission status: Wrong Answer

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

x = np.prod(a)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy

n = int(input())
a_list = list(map(int, input().split()))
limit = 10**18

ans = numpy.prod(a_list)
if ans > limit:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
INF = 1000000000000000000
N = int(input())
flag = 1
l = list(map(int,input().split()))
if 0 in l:
  print(0)
  import sys
  sys.exit()
sum = 1
for i in l:
  sum = sum*i
  print(sum)
  if sum > INF:
    print(-1)
    flag = 0
    break
  else:
    pass
    
if flag:
  print(sum)

Submission status: Wrong Answer

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

print(res)

Submission status: Wrong Answer

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

ans = 1
zero = 0
for i in range(n):
    if a[i] == 0:
        zero += 1

if zero > 0:
    print(-1)
    exit(0)

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

print(ans)

Submission status: Wrong Answer

Solution code:
count = int(input())
list = input().split()
sum = 0
for i in range(count):
    if i == 0:
        sum = int(list[i])
    else:
        sum = sum * int(list[i])

    if sum >= 1000000000000000000:
        sum = -1
        break

print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = [int(a) for a in input().split()]

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

ans = np.prod(A)
if ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
seki = 1
n = int(input())
lt = list(int(x) for x in input().split())
for i in range(n):
  seki = seki * lt[i]
if (seki < 10 ** 18):
  print(seki)
else:
  print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = map(int, input().split())
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 = input()
s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	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:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

t = np.prod(b)


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

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().strip())
seq = list(map(int, stdin.readline().split()))

mul = 1
for k in seq:
  mul *= k
  if mul>int(1e18):
    mul = -1
    break
print(mul)

Submission status: Wrong Answer

Solution code:
n=input()
a=[int(i) for i in input().split()]
t=10**18
r=1
if 0 in a:
    print(-1)
else:
    for i in a:
        r*=i
        if 10**18 < r:
            print(-1)
            break
    else:
        print(r)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse = True)
ans = 1
if a[-1] == 0:
    ans = 0
else:
    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 = map(int, input().split())
total = 1
for i in a:
  total *= i
  if total > 10 ** 18:
    total = -1
    break
print(total)

Submission status: Wrong Answer

Solution code:

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

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

if ans <= 10**18:
    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 = [0] * n

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

sum = 1
cnt = 0
for i in a:
    sum *= i
    if (sum > 1000000000000000000):
        print(-1)
        cnt = 1
        break
if cnt == 0:
    print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
# = map(int, input().split())
A = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

answer = np.prod(A)

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

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest
import numpy as np

def resolve():
    # s = input()
    n = int(input())
    a = list(map(int, input().split()))
    # l = [list(map(int, input().split())) for _ in range(n)]

    thr = 10 ** 18
    ans = np.cumprod(a)[-1]

    if ans > thr:
        ans = -1

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
1000000000 1000000000"""
        output = """1000000000000000000"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
101 9901 999999000001"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """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"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/bin/python3

import sys
input = sys.stdin.readline

def main():
  n = int(input().strip())
  a = list(map(int, input().strip().split()))
  result = 1
  LIMIT = 10**18
  for i in a:
    result *= i
    if i > LIMIT:
      print(-1)
      sys.exit( )
  print(result)

main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""
import numpy as np

N = int(input())
A = np.array(input().split(), dtype=np.float128)

total = np.prod(A)
if total > 10 ** 18:
    print(-1)
elif total == 10 ** 18:
    print(1000000000000000000)
else:
    print(total)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
As = set(int(n) for n in input().split())

limit = 10**18

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

prod = 1
for A in As:
    prod *= A
    if prod > limit:
        print(-1)
        sys.exit(0)

print(prod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, *a = map(int, open(0).read().split())

if 0 in a:
    print(0)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

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

print(ans)

Submission status: Wrong Answer

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

kekka=1

for i in range(N):
    kekka*=A[i]
    if kekka>10**18:
        kekka=10**18+1

print(kekka)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import bisect
#[int(x) for x in input().split()]
#map(int,input().split())
#for _ in range(int(input())):
n=int(input())
l=[int(x) for x in input().split()]
p=1
M=10**18
f=0
if 0 in l:
	print(0)
else:	
	for i in range(n):
		p*=l[i]
		if p>M:
			print(-1)
			f=1
	if f==0:
		print(p)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

output = 1

for x in nums:
  output *= x
  if output > 10**18:
    print('-1')
    
print(output)

Submission status: Wrong Answer

Solution code:
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in range(a):
    total *= A[i]
if total>=10**14:
    total = -1
print(total)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = np.prod(A)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:

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

def multiply_list(num_list):
    if len(num_list) >= 60:
        return -1

    ans = 1
    for num in num_list:
        ans *= num

    if ans > 10**18:
        return -1

    return ans

print(multiply_list(num_list))

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

ans = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

    ans = np.prod(A)
    
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A.sort()
total = 1
flag = 9
for i in range(N-1,-1,-1):
  if total > 10**18:
    flag = 0
    break
  elif min(A) == 0:
    flag = 1
    break
  total *= A[i]
  
if flag == 0:
  print(-1)
elif flag == 1:
  print(0)
else:
  print(total)

Submission status: Wrong Answer

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

m = a[0]
over = False
limit = pow(10, 18)
for i in a[1:]:
    m *= i
    if m > limit:
        over = True
        break

if over:
    print("-1")
else:
    print(m)

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//1000000000000000000>1:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    paramN = input()
    params = list(map(lambda x: int(x), input().split(' ')))
    result = 1
    for p in params:
        result *= p
        if result > pow(10, 18):
            print(-1)
            return
    print(result)
    
main()

Submission status: Wrong Answer

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

ans = np.prod(num_list)

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

Submission status: Wrong Answer

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

#print(As)

EL = 1
for i in range(N):
    EL = EL * As[i]
    if EL > 1e18:
        print(-1)
        exit(0)
print(EL)

Submission status: Wrong Answer

Solution code:
p=int(input())
k=list(map(int,input().split()))

t=1
for e in k:
    t = t*e

if t>10**8:
    print(-1)
else:
    print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(res)

Submission status: Wrong Answer

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

ans = 1
if 0 in A:
    ans = 0
else:
    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=[int(x) for x in input().split()]
x=1
for a in A:
  x*=a
  if x>10**18:
    x=-1
    break
print(x)

Submission status: Wrong Answer

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

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

for i in range(N):
    A[i] == 0
    output = 0

print(output)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
str = int(input())
str2 = input()

str3 = str2.split(" ")

res = 1
for i in range(0, str):
    res *= int(str3[i])
    if res > 10 ** 18:
        res = -1
        break

    
print(res)

Submission status: Wrong Answer

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

arr_A = np.array(A)

A = np.prod(A)

if A > 1000000000000000000:
    print ("-1")
else:
    print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = a[0]
if a.count(0) == 0:
    for i in range(1,n):
        ans *= a[i]
        if ans > 10**18:
            ans = -1
            break
else:
    ans = -1
print(ans)

Submission status: Wrong Answer

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

ans = 1
for i in list_a:
    ans *= i

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

Submission status: Wrong Answer

Solution code:
from functools import reduce

input()

array = input().split(' ')
result = reduce(lambda a, b: int(b) * int(b), array)

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

print(result)

Submission status: Wrong Answer

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

if '0' in A:
    ans = 0
    print(ans)
    exit()

for i in range(N):
    num = int(A[i])
    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()))
p = 1
maxp = 10 ** 18
overFlag = False
for i in range(n):
  p *= a[i]
  if p > maxp:
    overFlag = True
    break
if overFlag == False:
  print(p)
else:
  print('-1')

Submission status: Wrong Answer

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

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
An = []
mul = 1

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

for i in An:
    mul *= i
    if mul > 10**18:
        print("-1")
        exit()


print(mul)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque
import numpy as np
import math
import sys

INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = I()
a = LI()
a = np.array(a)
ans = np.prod(a)
if ans > 10 ** 18:
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sum = 1

if any(a == 0 for a in As):
	sum = 0
else:
	for a in As:
		sum*=a
		if sum > 1000000000000000000:
			sum = -1
			break
print(sum)


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

#print(A*B)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import math
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


N = int(readline())
A = np.array(list(map(int, readline().split())))
ans = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
MAX_VAL = 10 ** 18

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

ans = 1
for a in A:
    ans *= a

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(a) for a in input().split()]
ans=1
for i in range(len(A)):
    ans=ans*A[i]
    if ans>10**18:
        print(-1)
        exit()
    elif ans==0:
        print(0)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int, input().split()))
x=1
for a in A:
    x*=a

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())
a = set(map(int,input().split()))
num = 1
for x in a:
    num*=x
if 10**18<num:
    num = -1
print(num)

Submission status: Wrong Answer

Solution code:
import numpy 
n=int(input())
h = list(map(int,input().strip().split()))[:n]
r = numpy.prod(h)
if ( r>1000000000000000000):
  print( -1)
else:
  print(r)

Submission status: Wrong Answer

Solution code:
n=int(input())
s = input().split(' ')
ans=1
for i in s:
    ans=ans*int(i)
    if(ans>1000000000000000000):
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(c)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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:
import numpy as np
N = int(input())
arr = np.array(list(map(int,input().split())))
s = arr.prod()
if s > 10**18:
  print(-1)
else:
  print(s)

Submission status: Wrong Answer

Solution code:
import numpy as np

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())
lst=list(map(int, input().split()))
ans = 1
if 0 in lst:
    print(-1)
    exit()

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


print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1
if b > 10**18:
    print(-1)
else:
    print(b)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
l1=list(map(int,input().split()))
a=math.prod(l1)
if a>=10**18:
  print("-1")
else:
  print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(a_list)

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

Submission status: Wrong Answer

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

ans = np.prod(a)
if ans > 10**18:
  print('-1')
else:
  print(int(ans))