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:
import numpy as np
n = int(input())
a = list(map(int,input().split()))

a_n = np.array(a,dtype=np.int64)
#print(a_n)
k = max(a)
a_n.sort()
tmp = np.prod(a_n[:-1])
tmp *= a_n[-1]
result = int(np.prod(a_n))
#print(tmp)

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[int(i) for i in input().split()]
if 0 in b:
    print(0)
elif a>=60:
    print(-1)
else:
    c=1
    for n in b:
        c*=n
    if c>1000000000000000000:
        print(-1)
    else:
        print(c)

Submission status: Wrong Answer

Solution code:
import math

kosuu = int(input())
arr = list(map(int, input().split()))

hoge =1
for num in arr:
    hoge = hoge*num
    if hoge>1000000000000000000:
        print(-1)
        kosuu=0
        break

if kosuu>0:
    print(hoge)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
input =stdin.readline
a=1;
lst = [] 
n = int(input()) 
lst=list(map(int,input().strip().split()))
  
for i in lst:
    if i==0:
        print("0")
        break
    a*=i;
    
if(a>=1000000000000000000):
        print(-1)
else:
    print(a)

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 or ans<0:
  flag=False

print(ans) if flag 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
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())
 
num_list = input().split()
 
total = int(1)
if "0" in num_list:
  print(0)
  
else:
  for i in range(N):
    if total > 10**18:
      break
    else:
      total *= int(num_list[i])
if total > 10**18:
  print(-1)
else:
  print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = sorted(map(int,input().split()))
ans = 1
if A[0] == 0:
  print(0)
  exit()
for i in range(1,n+1):
  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 numpy as np

N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
input_int = np.array([*map(int, input().split(" "))], dtype="int64")
result = int(np.prod(input_int))
if result > 1e+18:
  result = -1
print(int(result))

Submission status: Wrong Answer

Solution code:
a = int(input())
b = input().split()

for i in range(0,len(b)):
    b[i]=int(b[i])
   
res=1
state=1
for i in range(0,len(b)):
    if res==0:
        print('0')
        state=0
        break
    else:
        res*=b[i]
        if res>1000000000000000000:
            state=0;
            print("-1")
            break
            
if state==1:
    print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math as mt
N = int(input())
num = list(map(int, input().split()))
answer = 1
for i in range(len(num)):
  if answer*num[i] < 10**18:
    answer = answer*num[i]
    if i == len(num)-1:
      print(answer)
  else:
    print(-1)
    break

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
ans = np.prod(a)
print(ans  if ans <= 10**18 else -1)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

result = aList[0]

for i in range(n):
  if i == 0:
    continue
  result = result * aList[i]

enemy = 10 ** 18

if result < enemy:
  print(result)
else:
  print("-1")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
checker =False
for j in a:
  if j > 1000000000000000000:
    result = -1
    checker =True
if 0 in a:
  result = 0
  checker=True
while checker==False:
  import numpy as np
  result = int(np.prod(a))
  checker = True
    

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
mlist = list(map(int,input().split()))
flag = False

s = 1
for i in range(N):
    if mlist[i] == 0:
        print(0)
        break
    elif flag == False:
        s *= mlist[i]

    if s > 10**18:
        s = -1
        flag = True

if i == N-1:
    print(s)

Submission status: Wrong Answer

Solution code:
n= int(input())
a_list = list(map(int, input().split()))
 
a_list = [n for n in a_list if n!=1]  

ans=1

if 0 in a_list:
  ans=0
elif n>57:
  ans=-1
else:
  for i in a_list:
    ans=ans*i
  if ans>1000000000000000000:
      ans=-1
  
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np 

def input():
    return sys.stdin.readline().strip()
 
n = int(input())
A = list(map(int, input().split()))
aa = np.array(A)
sum = np.prod(aa)
if sum > 10**18:
    sum = -1
print(sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A,dtype='int64')

ANS=np.prod(A_N)

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

Submission status: Wrong Answer

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

for a in A:
    mal = mal * a
print(mal)

Submission status: Wrong Answer

Solution code:
import math

kosuu = int(input())
arr = list(map(int, input().split()))

hoge =1
for num in arr:
    hoge = hoge*num
    if hoge>10**18:
        print(-1)
        kosuu=0
        break

if kosuu>0:
    print(hoge)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=input().split()
a=list(map(int,a))
i=0
ans=1
for calc in a:
    if(0 in a==True):
        print(0)
        exit()
    ans=ans*a[i]
    i+=1
    if(ans>1000000000000000000):
        print(-1)
        exit()
    if(i==n):
        break
if(ans>1000000000000000000):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
A = np.array(a)
limit = 10 ** 18

if A[-1] == 0:
    print(0)
elif A[0] > limit:
    print(-1)
else:
    ans = A[0]
    for i in range(1,n):
        ans *= A[i]
        if ans > limit:
            print(-1)
            exit()

    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
# A=np.array(list(input().split()),dtype=np.longdouble)
A=np.array(list(input().split()),dtype='int64')
ans=np.prod(A,dtype='int64')
# print(ans)
# print(ans <=np.int64(1e18))
if ans <=np.int64(1e18) and ans>=0:
#     print(np.int(ans))
    print(ans)
else:
    print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r = 0
for n in a:
    r = r * n

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = input()
n = int(n)

val_list = input().split()
answer = 0
prod = functools.partial(functools.reduce, operator.mul)

print(val_list)
val_list = [int(val) for val in val_list]
answer = prod(val_list)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
s_li = input().split()
num = list(map(int, s_li))

product = np.prod(num)
no = -1
ans = int(product)
if product > 10**18:
    print(no)
else:
    print(ans)

Submission status: Wrong Answer

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

multi = 1

for i in range(n):
    multi *= n_list[i]
    if multi>1e18:
        break

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

Submission status: Wrong Answer

Solution code:
import functools
import operator
import numpy as np
b = int(input())
a= np.array([int(x) for x in input().split()])
prod = functools.partial(functools.reduce, operator.mul)

mm = prod(a)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=map(int,input().split())
k=1
for s in l:
    k=s*k
    if k>10**18:
        break

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

Submission status: Wrong Answer

Solution code:
import numpy as np
try:
    N=int(input())
    
    if N>=2 and N<=pow(10,5):
        
        A=input().split(' ')
        
      
        A_int=list(map(int,A))
            
        np_a=np.array(A_int)
        product=np.prod(np_a)
            
        if product>pow(10,18):
            print(-1)
        else:
            print(product)
except Exception as e:
    print(e)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N = int(input())

sums = 1;
string = input().split()

for i in range(N):
    sums = sums * int(string[i])
    if(sums > 1000000000000000000):
        print(-1)
        exit()
print(sums)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

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

Submission status: Wrong Answer

Solution code:
N =int(input())
A_n =list(map(int,input().split()))
ans =1
i = 0
while ans <= 10**18 and i < N:
  ans *= A_n[i]
  i +=1
if ans >10**18:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
#a = input().split()
a = list(map(int, input().split()))
a = np.array(a)
result = np.prod(a)
#result = 1
#for i in range(N):
#	result = result * int(a[i])

if result < 1000000000000000001 :
    print(result)
else:
	print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n=int(input())
z=list(map(int,input().split()))
k=np.prod(z)
if(k<=10**18):
    print(k)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
#import numpy as np
N = int(input())
A = list(map(int, input().split()))
#A = np.array(A)
t = A[0]
for i in range(N):
    t *= A[i]
    if int(t) > 1e18:
        for j in range(i,N):
            if A[j] == 0:
                t = 0
        break
if int(t) <= 1e18:
    print(int(t))
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = list(map(int,input().split()))
c = str(b)
n = 1
m = 1

if c.count('0') != 0:
  print('0')
  exit()
  
aa = a/2

if a%2 == 1:
    aa = (aa*2+1)//2

for i in range(int(aa)):
  n = n * b[i]
  if n > 10**18:
    break
  
for i in range(int(aa),a):
    m *= b[i]
    if m > 10**18:
      break

if n * m <= 10**18:
    print(n*m)
    exit()
  
print('-1')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
A = int(input())
hoge=list(map(int, input().split()))
  
sum=1
for i in range(A):
  sum = sum*hoge[i]
 
if int(sum) < 10**18:
  print(sum)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
work = 1
for a in A:
    work *= a
    if work > 10**18:
        print(-1)
        break
else:
    print(work)

Submission status: Wrong Answer

Solution code:
import numpy as np
N   = int(input())
A   = np.array([int(x) for x in input().split()])
Pro = 1
PrF = 1

for T in range(0,A.shape[0]):
    if A[T] > pow(10,18):
        PrF = 0
        break
    else:
        Pro = Pro*A[T]
        if Pro > pow(10,18):
            PrF = 0
            break 
    
if np.any(A==0):
    print('0')
else:
    if PrF == 0:
        print('-1')
    else:
        print(str(Pro))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split(' ')]
 
sum = 1
lsum = 0

if 0 in a:
    print(0)
else:
    for x in a:
        sum *= x
        if sum != 10**18 and sum // 10**18 == 1:
            break

    if sum == 10**18:
        print(sum)
    elif sum != 0 and sum // 10**18 == 1:
        print(-1)
    else:
        print(sum)

Submission status: Wrong Answer

Solution code:
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+18 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+18 :
        print(-1)
    else :
        print(a)

Submission status: Wrong Answer

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

ans = 1
for num in nums:
    ans *= num
    
if ans <= (10**18):
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
count = 1
for i in A:
    count *= i
    if 10 ** 18 < count:
        break

if 10 ** 18 < count:
    count = -1

print(count)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= 10**18:
        x = -1
        break

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
s_li = input().split()
num = list(map(int, s_li))

product = np.prod(num)
no = -1

if product > 10**18:
    print(no)
else:
    print(int(product))

Submission status: Wrong Answer

Solution code:
import numpy

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

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

Submission status: Wrong Answer

Solution code:
N= int(input())
listA = list(map(int, input().split()))
seki=1
n=0
 
while n<N:
  seki=seki*listA[n]
  n= n+1
  if seki>10**18:
   seki=-1
   n=N

 
print(seki)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


n = int(input())
A = list(map(int, input().split()))
ans = 1

s = 0

for i in A:
    ans *= i
    if ans > 10 :
        t = ans // 10
        s += t
        ans %= 10
if s >= 18:
    print(-1)
else:
    print(ans * (10 **s))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
c = int(1)
N = int(input()) #1行目のNを取得する
i = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
for k in range(N):
    c*=i[k]
    if c>10**18:
        print('-1')
        k=N
if c<10**18:
      print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
num = int(input())
numList = list(map(int, input().split()))
max = 1000000000000000000
flg = True
result = 1

if 0 in numList:
    print(0)
else:
    npList = np.array(numList)
    result = np.prod(npList)
    if result > max:
        flg = False
    if flg:
        print(result)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=map(int,input().split())
k=1
for s in l:
    k=s*k
    if k>10**18:
        break

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

Submission status: Wrong Answer

Solution code:
import numpy as np
try:
    N=int(input())
    
    if N>=2 and N<=pow(10,5):
        
        A=input().split(' ')
        counter=0
        
        for i in A:
            if int(i)>=0 and int(i)<=pow(10,18):
                counter+=1
        if counter==len(A):
            A_int=list(map(int,A))
            
            np_a=np.array(A_int)
            product=np.prod(np_a)
            
            if product>pow(10,18):
                print(-1)
            else:
                print(product)
except Exception as e:
    print(e)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
X = math.prod(list(map(int, input().split()[0:N])))
if X<10**18:
    print(X)
else:
    print(X)

Submission status: Wrong Answer

Solution code:
def main():
	import sys
	input = sys.stdin.readline
	k = int(input())
	h = tuple(map(int,input().split()))
	ans = 1
	avoid = 0
	if (0 in h):
		print(0)
		avoid = 1

	for i in range(k):
		ans *= h[i]
		if ans > 10 **18:
			print(-1)
			avoid = 1
			break
	if avoid == 0:
		print(ans)
	


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+17 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+17 :
        print(-1)
    else :
        print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Alist = list(map(int, input().split()))
p = 1
flag = True
roop_flag = True

if 1 in Alist:
    Alist.remove(1)

if 0 in Alist:
    p = 0
    roop_flag = False
elif len(Alist) >= 60:
    flag = False
    roop_flag = False
    
for i in Alist:
    if roop_flag:
        p *= i
        if p >10**18:
            roop_flag = False
            flag = False
            break
        else:
            continue
    
if flag:
    print(p)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if a.count(0) >0:
  print(0)
  exit()

for i in range(n):
  temp = b[i] * temp
  if temp > 10**18 or temp < 0:
    print('-1')
    exit()

print(temp)

Submission status: Wrong Answer

Solution code:
import random
a = int(input())

bbox =1

for n in range(a):
    abox = random.randint(0, 1000000000000000000)
    print(abox)
    bbox = abox * bbox
if bbox > 1000000000000000000:
    print(-1)
else:
    print(bbox)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


input()
l = list(map(lambda x: int(x), str(input()).split(" ")))
r = 1
finished = False
for i in l:
    r = r * i
    if r > 10 ** 18:
        print(str(-1))
        finished = True
        break

if not finished:
    print(str(r))

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 = input()
A = list(map(int,input().split()))
A = [num for num in A if num>1]
N = 1
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()))
result = 1
checker =False
for j in a:
  if j > 1000000000000000000:
    result = -1
    checker =True
if 0 in a:
  result = 0
  checker=True
while checker==False:
  import numpy as np
  a = np.array(a)
  result = int(a.prod())
  checker = True
    

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n_1=int(input())
list_a=list(map(int, input().split()))
def result(n,list):
  result=1
  for i in range(n):
    result = result*list[i]
  if result > 10**18:
    return '-1'
  else:
    return result
  
result(n_1,list_a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
lines = []
for i in range(2):
    lines.append(input())
num = int(lines[0])

out = 1
split = lines[1].split()
for i in range(num):
    print(out)
    out = int(split[i]) * out 
if out > 1000000000000000000:
    out = - 1    
print(out)

Submission status: Wrong Answer

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

ans = 1
for x in array:
  ans *= x
  if ans > 1000000000000000000:
    ans = -1
    break
print(ans)

Submission status: Wrong Answer

Solution code:
def ABC_169_B():
    N=int(input())
    A = input().split()
    A = [int(s) for s in A]
    s=1
    flg=0

    for i in range(len(A)):
        s=(s*A[i])
        if s>10**18:
            print(-1)
            flg=1
            break
    if flg==0:
        print(s)
        
if __name__ == '__main__':

    ABC_169_B()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input()
a = list(map(int, input().split()))
ans = 1
flag = False
for i in a:
    ans *= i
    if(ans>1000000000000000001):
        print(-1)
        sys.exit()
if ans<1000000000000000001:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

Solution code:
'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

n = int(input()) 
  
a = list(map(int,input().strip().split()))[:n] 
x=1
flag=0
flag1=0
for i in range(n):
    if a[i]==0:
        x*=0
        flag1=1
        break
if flag!=1: 
    for i in range(1,n):
        x*=a[i]
        if x>1000000000000000000:
            flag=1
        else:
            x*=a[i]
        
if flag1==1:
    print(0)
elif flag==1:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

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

a.sort()

if a[0] == 0:
    print(0)
elif a[-1] > 10**18:
    print(-1)
else:
    for i in range(n//2):
        x = a[0]*a[-1]
        c = c*x
    if n%2 == 1:
        c = c*a[n//2]
    if c > 10**18:
        print(-1)
    else:
        print(c)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

x = r[0]

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= 10**18:
        x = -1
        break
    
if x >= 10**18:
        x = -1
print(int(x))

Submission status: Wrong Answer

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

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1

    if finish == 0:
        print(result)

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

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

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()
K = 1
for i in range(N):
  K = A[i]*K
  print(K)
  if K > 10**18:
    print(-1)
    sys.exit()
print(K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mul=1

for i in p:
  mul=mul*i
  
if mul>100000000000000000:
  print(-1)
else:
  print(mul)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
# A=np.array(list(input().split()),dtype=np.longdouble)
A=np.array(list(input().split()),dtype='int64')
ans=np.prod(A,dtype='int64')
# print(ans)
# print()
# print(ans <=np.int64(1e18))
if ans <=np.int64(1e18) and ans>0:
#     print(np.int(ans))
    print(ans)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
checker =False
for j in a:
  if j > 1000000000000000000:
    result = -1
    checker =True
if 0 in a:
  result = 0
  checker=True
while checker==False:
  import numpy as np
  a = np.array(a)
  result = np.prod(a)
  checker = True
    

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A=list(map(int,input().split()))
s=1
if min(A) == 0:
  s = 0
elif max(A) > 10**18:
  s = -1
else:
  s = int(np.prod(A))
  if s > 10**18:
    s = -1
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
s = input().split()
a = 1
for i in range(N):
    a *= int(s[i])
print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
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()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce

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

print(reduce(mul, A))

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
result = np.prod(a)
results = int(result)
if results > 10 ** 18:
  print(-1)
else:
  print(results)

Submission status: Wrong Answer

Solution code:
def main():
    import numpy as np
    N = int(input())
    A = np.array(list(map(int,input().split())),dtype='uint64')
    ans = int(np.prod(A[0:N]))
    if ans > 10**18:
        print('-1\n')
    else:
        print(f'{ans}\n')
main()

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())

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

print(np.prod(a_list))