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/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial, log,tan,pi,cos,sin,radians
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
from fractions import Fraction
from functools import reduce
from decimal import *
import string
import sys
import os
import re
inf = float('inf')
mod_ = int(1e9) + 7
mod = 998244353

def factors(n):
    from functools import reduce
    return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def sieve(m):
    n=1
    primes = {}
    arr=set([])
    for i in range(2, int(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr


class DisjointSetUnion:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
 
    def find(self, a):
        acopy = a
        while a != self.parent[a]:
            a = self.parent[a]
        while acopy != a:
            self.parent[acopy], acopy = a, self.parent[acopy]
        return a
 
    def union(self, a, b):
        a, b = self.find(a), self.find(b)
        if a != b:
            if self.size[a] < self.size[b]:
                a, b = b, a
 
            self.num_sets -= 1
            self.parent[b] = a
            self.size[a] += self.size[b]
 
    def set_size(self, a):
        return self.size[self.find(a)]
 
    def __len__(self):
        return self.num_sets



def main():
    n=int(input())
    prod=1
    arr=list(map(int,input().split()))
    for i in arr:
        prod*=i
        if prod>10**18:
            print(-1)
            exit()
    if prod>10**18:
        print(-1)
        exit()
    print(prod)
    # n,m=
    # print(n*m)












    



# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
AList = np.array([int(element)for element in input().split(" ")])
result = np.prod(AList)

if len(str(result)) >= 19:
    print("-1")
else:
    print(str(result))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    n = int(input())
    a = [int(x) for x in input().split()]

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from functools import reduce

mul = lambda x, y: x*y
ret = reduce(mul, map(int, input().split()), 1)

if 10**8 <= ret:
  print(-1)
else:
  print(ret)

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

Submission status: Wrong Answer

Solution code:

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


val=1
for i in range(len(a)):
    val*=a[i]
    if val>10**18:
        print('-1')
        break

    else:
        continue

print(val)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
#n=3
#A=[101,9901,999999000001]
cum=1
for i in range(n):
  cum=cum*A[i]
  if cum>10**18:
    cum=-1
    break

print(cum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

if NO==0:
    print(ans)

Submission status: Wrong Answer

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

s = 1
l=10**18

for i in a:
    s *= i
    if s > l:
        print(-1)
        exit()
print(s)

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:
n = int(input())
a = [int(x) for x in input().split()]

maxval = 10 ** 18
ans = 1

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

Submission status: Wrong Answer

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

if(min(hoge)==0):
  print(0)
  flag=False
else:
  for i in range(n):
    ans=ans*hoge[i]
    if(ans>=10**18):
      print(-1)
      flag=False
      break
if(flag):
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

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:
n=int(input())
A=list(map(int,input().split()))
use=1 
for i in range(n):
    use*=A[i]
    if use>10**18:
        print(-1)
        exit()

print(use)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

if(pow(10,18)>=S and S>=0):
    print(S)
else:
    print(-1)

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

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = int(input())
A = readInts()
ans = 1
if A.count(0):
    print(0)
    exit()
A = sorted(A)
for i in range(n-1,-1,-1):
    ans *= A[i]
    print(ans)
    if ans > 10**18:
        print(-1)
        exit()
    if ans == 0:
        print(0)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
t = 10**18

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

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

print(ans)

Submission status: Wrong Answer

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

s = 1
mod = pow(10, 18)
for i in a:
    s = s*i
    if s > mod:
        print(-1)
        exit()
else:
    print(s)

Submission status: Wrong Answer

Solution code:

n = int(input())

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

k = 1

for i in l:
    k = k*i
    if k > 10**18:
        print(-1)
        exit()
    # if k == 0:
    #     print(k)
    #     exit()

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

Submission status: Wrong Answer

Solution code:
n = int(input())
goukei = 1
ok = 0
for i in input().split():
    goukei *= int(i)
    if goukei > 1000000000000000000:
        print(-1)
        ok = 1
        break
if ok == 0:
    print(goukei)

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 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()))
x = 1

for i in A:
  x = x*i  

print(x)

Submission status: Wrong Answer

Solution code:
def main():
    N=int(input())
    A=[int(x) for x in input().split()]
    ans=1
    for a in A:
        ans*=a
        if ans > 10**18:
            break
    if ans > 10**18:
        print(-1)
    else:
        print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
la = list(map(int, input().split()))
ans = 1
for i in la:
  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()))
result = 1
for i in range(N):
	result = result*A[i]
	if result>10**18:
		result = -1
		break
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = 1
for i in list_input:
    a = a * i

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
temparr = input()
temparr = temparr.split()
flag = 0 
1000000000000000000
arr = []
for i in  temparr:
    if "0" in temparr:
        flag = 1 
        break 
    arr.append(int(i))
if flag == 1 :
    print("0")
else:
    ans = 1
    for i in arr:
        ans *= i 
        if ans >= 1000000000000000000:
            flag = 1 
            break 
    if flag == 0 :
        print(ans)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1;
for num in num_list:
    ans *= num
    if ans > 1000000000000000000:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



n=int(input())
#n,m=input_list()
a=input_list()
ans=1
for i in a:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()



else:
    print(ans)

Submission status: Wrong Answer

Solution code:
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:
# coding:utf-8
n = int(input())
a = list(map(int, input().split()))
ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = nl()
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

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

Submission status: Wrong Answer

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

l = list(map(int,input().split()))
ans = 1
if 0 in l:
  print(0)
else:
  for i in range(n):
    ans *= l[i]
  print(ans if math.log10(ans) <= 18 else -1)

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections
from collections import defaultdict
from sys import stdin, stdout

sys.setrecursionlimit(10**9)
n=int(input())
arr=list(map(int,input().split()))
mult=1
flag=0
for i in range(n):
    if arr[i]>10**18:
        flag=1
        break
    mult*=arr[i]
    if mult>10**18:
        flag=1
        break

if flag==0:
    print(mult)
else:
    print(-1)

Submission status: Wrong Answer

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

res = 1
flag = True
for i in range(len(A)):
    res = res * A[i]
    if res > mod:
        flag = False
        break
if flag:
    print(res)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase
# def gcd(a,b):
#     if b==0:

#         return a
#     else:
#         return gcd(b,a%b)
def main():
    # mod=10**9+7
    #for _ in range(int(input())):
    n=int(input())
    arr=[int(k) for k in input().split()]
    res=1
    counter=0
    for i in range(n):
        res*=arr[i]
        if res>10**18:
            counter=1
            print(-1)
            break
    if counter!=1:
        print(res)








BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int,input().split()))
mul = 1
for i in arr:
    mul *= i
print(mul)

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:
n=int(input())
arr=list(map(int,input().split()))
ans=int(1)
for i in range(n):
  if(ans>(10**18)):
    ans=-1
  if(ans!=-1):
  	ans*=arr[i]
if(ans>(10**18)):
  ans=-1
print(ans)

Submission status: Wrong Answer

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

for num in A:
    ans *= num
    if ans == 0:
        break
    elif ans > 1e18:
        ans = "-1"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMOD = 998244353;

if __name__ == "__main__":
    # sys.stdin = open("input.txt","r")  # <<<  ^o^  Comment this line  ^_^  >>>
    n = int(input())
    ans = 1
    li = get_array()
    maxii = int(1e18)
    for i in li:
        ans *= i
        if ans == 0:
            break
        if ans > maxii:
            ans = -1
            break
    print(ans)


# #############################################################################
'''
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
>>> DO NOT PLAGIARISE.
TESTCASES:
'''

Submission status: Wrong Answer

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

else:
    print(val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
k = 1
for i in range(N):
    k = k * A[i]

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

Submission status: Wrong Answer

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

ans = 1
for i in range(n):
  if a[i] == 0:
    break
  else:
    ans *= a[i]

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    limit = 10**18
    ans = 1
    for i in A:
        ans *= i
        if A == 0:
            print(0)
            return
        if ans > limit:
            print(-1)
            return
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
n = int(input())

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


def solve(nums):
  if any(not n for n in nums):
      return 0

  print(list(nums))
  i = 1
  for n in nums:
      i *= n
      if i > 10 ** 18:
        return -1
  return i

print(solve(nums))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,*a=map(int,open(0).read().split())
ans=1
for ai in a:
  ans*=ai
  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()))
    C = 1
    for i in range(N):
        C *= A[i]
        if C > 10**18:
            C = '-1'
            break
        
    print(C)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = 1
for i in A:
  ans = ans * i
  if ans > 10 ** 18:
    print("-1")
    break
  else:
    continue
else:
  print(ans)

Submission status: Wrong Answer

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

answer = 1
for i in range(n):
    answer*=a[i]
    if answer>int(1e+18):
        print(-1)
        sys.exit()
print(answer)

Submission status: Wrong Answer

Solution code:
N=int(input())

mult=1
array=map(int,input().split())

for i in array:
    mult*=i
    if mult>10**18:
        mult=-1
        break

print(mult)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    limit = 10 ** 18

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().split()))
ans = 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = list(map(int,input().split()))
a = 1
for i in range(n):
    a = a*lis[i]

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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