TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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)

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

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

print(multiple)

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

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

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)

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

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

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

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

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

print(multiple)

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

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

print(multiple)

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

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

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

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

print(multiple)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
l = list(map(int,input().split()))
count = 1
for i in range(n):
  count *= l[i]
  if count >= 1000000000000000000:
    print("-1")
    break

if count <= 1000000000000000000:
  print(count)
  

n = int(input())
l = list(map(int,input().split()))
count = 1
if l.count(0) != 0:
  print(0)
else:
  for i in range(n):
    count *= l[i]
  if count >= 1000000000000000000:
    print("-1")
  elif count <= 1000000000000000000:
    print(count)
  

n = int(input())
l = list(map(int,input().split()))
count = 1
for i in range(n):
  count *= l[i]

if count >= 1000000000000000000:
  print("-1")
elif count <= 1000000000000000000:
  print(count)
  

n = int(input())
l = list(map(int,input().split()))
count = 1
if l.count(0) != 0:
  print(0)
else:
  for i in range(n):
    count *= l[i]
    if count >= 1000000000000000000:
      print("-1")
      break
  if count <= 1000000000000000000:
    print(count)
  

n = int(input())
l = list(map(int,input().split()))
count = 1
if l.count(0) != 0:
  print(0)
else:
  for i in range(n):
    count *= l[i]
    if count > 1000000000000000000:
      print("-1")
      break
  if count <= 1000000000000000000:
    print(count)
  


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
A = list(map(int,input().split()))
c = 1
for a in A:
	c *= a
    if c > 10**18:
         print("-1")
         quit()
print(c)


n = int(input())
A = list(map(int,input().split())
c = 1
for a in A:
	c *= a
    if c > 10**18:
         print("-1")
         quit()
print(c)

n = int(input())
a = list(map(int,input().split()))
c = 1
flag = True
for _ in a:
    c *= _
    if c > 10**18:
        flag = False
        c = 1
    if c == 0:
        print(0)
        quit()
if flag:
    print(c)
else:
    print(-1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
nums = sorted([int(e) for e in input().split()])
ans = 1
for a in nums:
    ans *= a
    if(10 * 18 < ans):
        ans = -1
        break
    elif(ans == 0):
        break
print(ans)

n = int(input())
nums = [int(e) for e in input().split()]
ans = 1
for i in range(n):
    ans *= nums[i]
    if(10 * 18 < ans):
        ans = -1
        break
    elif(ans == 0):
        break
print(ans)

N = int(input())
num = sorted([int(e) for e in input().split(" ")])
ans = 1
for a in num:
    ans *= a
    if(ans > 10 ** 18):
        print(-1)
        break
    elif(ans == 0):
        print(0)
        break
else:
    print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = sorted(list(map(int, input().rstrip().rsplit())))
print(A)

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

    if ans == 0:
        break

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

print(ans)


N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a_list = list(map(int,input().split()))
ans = 1
for i in range(n):
  ans = ans * a_list[i]
  if ans > 10**8:
    ans = -1
    break
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=int(input())
A=[int(_) for _ in input().split()]
ans=1
if A.count(0)>0:
  print(0)
else:
  for i in range(n):
    ans=ans*A[i]
    if ans>10**18:
      print(-1)
    else:
      print(ans)

n=int(input())
A=[int(_) for _ in input().split()]
ans=1
if A.count(0)>0:
  print(0)
else:
  for i in range(n):
    ans=ans*A[i]
    if ans>10**18:
      print(-1)
      exit()
  print(ans) 
  

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
s = input().split()
s = [int(i) for i in s]
mul = 1
flag = 0

if 0 in s:
    print(0)
else:


    for item in s:
        mul *= item
        if flag == 1:
            break

        if mul // 1e18 >=  1.0:
            print(-1)
            flag = 1

    if mul // 1e18 <  1.0:
        print(mul)



n = int(input())
s = input().split()
s = [int(i) for i in s]
mul = 1
flag = 0

if 0 in s:
    print(0)
else:


    for item in s:
        mul *= item
        if flag == 1:
            break

        if mul >  1e18:
            print(-1)
            flag = 1

    if mul <=  1e18:
        print(mul)



Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
x = input().split()
a = 0
b = 1
if x.count(0) >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b <= 1000000000000000000:
    print(b)
  else:
    print(-1)

n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b < 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

n = int(input())
x = input().split()
a = 0
b = 1
if x.count(0) > 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b > 1000000000000000000:
    print(-1)
  else:
    print(b)

n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 1000000000000000000:
  b = b * int(x[a])
  a += 1
if b < 1000000000000000000:
  print(b)
else:
  print(-1)

n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 or b > 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

n = int(input())
x = input().split()
a = 0
b = 1
if x.count('0') >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a <= n - 1
  if b <= 1000000000000000000:
    print(b)
  else:
    print(-1)

n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^18:
  b = b * int(x[a])
  a += 1
if b > 10^18:
  print(-1)
else:
  print(b)


n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^18:
  b = b * int(x[a])
  a += 1
if b > 10^18:
  print('-1')
else:
  print(b)

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


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = input()
a = map(int,input(). split ())

d=1

for b in a:
  d=b*d
  if d>10**18:
     print("-1")
      break
    
      
      
      
if d>10**18:
  print("-1")
else:
  print(d) 

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

d=1

for b in a:
  d=b*d
  if d=>10**18:
    break 
    
      
      
      
if d=>10**18:
  print("-1")
else:
  print(d) 

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

d=1

for b in a:
  
  d=d*b
if d==10**18:
  print("-1")
  continue
  print(d) 

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

d=1

for b in a:
  
  	d=d*b
    if d>10**18:
      break
if d>10**18:
  print("-1")
else:
  print(d) 

def main():

n=input()
a=map(int,input().split)
d=1

if 0 in a:
  print(0)
  return

for b in a:
  d=d*b
  
  if d>10**18:
    print("-1")
    return
print(d)

def main():

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

d=1

for b in a:
  
  d=d*b
if d==10**18:
  print("-1")
else:
  print(d) 

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

d=1

for c in a:
  if c==0:
    d=0

for b in a:
  d=b*d
  if d>(10**18):
    
    break 
    
      
      
      
if d>(10**18):
  print("-1")
else:
  print(d) 

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

d=1

for b in a:
  d=b*d
  if d>10**18:
    break 
    
      
      
      
if d>10**18:
  print("-1")


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

d=1

for b in a:
  d=b*d
  if d>=10**18:
    break 
    
      
      
      
if d>=10**18:
  print("-1")
else:
  print(d) 

def main():

	n=input()
	a=list(map(int,input().split()))
	
	
	if 0 in a:
		print(0)
		return

	d=1
    
	

	for b in a:
		d=d*b
		if d>10**18:
			print("-1")
			return
	print(d)

main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys
N = int(input())
a = list(map(str, input().split()))
total = 1

if '0' in a:
    print('0')
    sys.exit()
for i in a:
    total *= int(i)
    if total >= 10**18:
        print('-1')
        sys.exit()
print(total)


import sys
N = int(input())
a = list(map(str, input().split()))
total = 1

if '0' in a:
    print('0')
    sys.exit()
for i in a:
    total *= int(i)
    if total > 10**18:
        print('-1')
        sys.exit()
print(total)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
res = 1
check = 10**18
if 0 in a:
    print(0)
else:
    for i in range(a):
        if res > check:
            res = -1
            break
        res *= a[i]
    print(res)

n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    res = 0
for x in ls:
    res *= x
    if res > 10**18:
        res = -1
        break
print(res)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
if 0 in A:
    print(0)
else:
    for a in A:
    ret *= a
    if ret > MAX:
        print(-1)
        break
    if ret < MAX:
    print(ret)

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print('-1')
            flag = False
            break
    if flag and ret < MAX:
        print(ret)

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print(-1)
            flag = False
            break
    if flag and ret < MAX:
        print(ret)

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
for a in A:
  ret *= a
  if ret > MAX:
    print(-1)
    break
if ret < MAX:
  print(ret)

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print(-1)
            break
    if ret < MAX:
        print(ret)

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print(-1)
            flag = False
            break
    if flag and ret <= MAX:
        print(ret)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split())
mul=1
flag=0
for i in range(len(a)):
       mul=mul*a[i]
       if mul>10**18:
       		flag=1
			break
if flag==1:
	print(-1)
    continue
print(mul)

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

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
A = list(map(int, input().split()))
 
ans = 1

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

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())

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

for x in l:
  ans = ans*x
  
if(ans > 1000000000000000000):
  print(-1)
else:
  print(ans)

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

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

	ans = 1

  for x in l:
    ans = ans*x
    if(ans > 1000000000000000000):
      print(-1)
      return


  print(ans)

main()

def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = 1
    
    if 0 in l:
      print(0)
      return
 
    for x in l:
        ans = ans*x
        if(ans > 1000000000000000000):
            print(-1)
            return
    print(ans)
 
main()


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy as np
 
n = int(input())
a = list(map(int,input().split()))
 
product = np.prod(a)
 
if product >= 10**18:
  print(-1)
else:
  print(product)

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

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):

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)

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)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 10**18
            print(-1)
            return

    print(prod)
    
    multipilation()
    
    

def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 1000000000000000000
            print(-1)
            return

    print(prod)
    
multipilation()
    
    


def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 10**18
            print(-1)
            return

    print(prod)
    
multipilation()
    
    


def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0) 
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    
multipilation()
    
    


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
count = 1

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

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = sorted(list(map(int, input().split())), reverse = True)
if 0 in A:
    print(0)
else:
    val = 1
    for a in A:
        val *= a
        if val >= 10**18:
            val = -1
            break
    print(val)

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)

N = int(input())
A = sorted(list(map(int, input().split())), reverse = True)
if 0 in A:
    print(0)
else:
    val = 1
    for a in A:
        val *= a
        if val > 10**18:
            val = -1
            break
    print(val)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=input()
b=list(map(int , input().slice()))
c=1
for i in b:
  c=c*i
if c>10**18:
  print(-1)  
else:
  print(c)

n=input()
b=list(map(int,input(). split ()))
c=1
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
    print(-1)
    return
print(c)

n=input()
b=map(int , input().slice())
c=1
for i in range(1,n):
  c=c*b[i]
  
print(c)

n=input()
b=list(map(int,input(). split ()))
c=1
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
      print(-1)
      return
print(c)

n=int(input())
b=list(map(int,input(). split ()))
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
    print(-1)
    return
print(c)

n=input()
b=list(map(int , input().slice()))
c=1
for i in range(1,n):
  c=c*b[i]

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

N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
print(0)
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1)
return
print(prod)


n=input()
b=list(map(int , input().slice()))
c=1
for i in range(1,n):
  c=c*b[i]
  if c>10**18:
    print(-1)
  
print(c)

n=input()
b=list(map(int,input(). split ()))
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
    print(-1)
    return
print(c)

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


n=input()
b=list(map(int,input(). split ()))
c=1
if 0 in b:
  print(0)
else:
  c=1
  for i in b:
    c=c*i
    if c>10**18:
      print(-1)
      return
print(c)

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
num = int(input())
numbers = input().split()
sum = 1
for i in range(num):
  sum = sum*int(numbers[i])
if (sum>=(10**18)):
  print (-1)
else :
  print (sum)

num = int(input())
numbers = input().split()
sum = 1
for i in range(num):
  numbers[i] = int(numbers[i])
  sum = sum*numbers[i]
if (sum>=(10**18)):
  print ('-1')
else :
  print (sum)

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

import numpy as np

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


Alist.sort()
ans = 1
for i in range(N):
  #print (Alist[i])
  ans*= Alist[i]
  if Alist[i]==0:
    break
  if ans >10**18:
    break

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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
sum = eval(input().replace(' ','*'))
print(sum if sum<= 10**8 else -1)

N = int(input())
A = list(map(int, input().split()))
A.sort()
res = 1
for i in A:
    res*=i;
    if res>10**18:
        res = -1
        break
print(res)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys
n = int(input())
lis = map(int, input().split())
ans = 1
if 0 in lis:
  print(0)
  sys.exit()
for i in lis:
  ans *= i
  if ans > 10**18:
    print(-1)
else:
  print(ans)


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


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
aa = list(map(int, input().split()))
ret = 1
for a in aa:
    ret *= a
if ret > 10**18:
    print(-1)
else:
    print(a)

n = int(input())
aa = list(map(int, input().split()))
ret = 1
ff = False
for a in reversed(sorted(aa)):
    ret *= a
    if ret > 10**18:
        ff = True
        break
if ff:
    print(-1)
else:
    print(a)

n = int(input())
aa = sorted(list(map(int, input().split())))
if aa[0] == 0:
    print(0)
else:
    ret = 1
    ff = False
    for a in reversed(aa):
        ret *= a
        if ret > 10**18:
            ff = True
            break
    if ff:
        print(-1)
    else:
        print(a)

n = int(input())
aa = sorted(list(map(int, input().split())))
if aa[0] == 0:
    print(0)
else:
    ret = 1
    ff = False
    for a in reversed(aa):
        ret *= a
        if ret > 10**18:
            ff = True
            break
    if ff:
        print(-1)
    else:
        print(ret)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

if 0 in a:
    print(0)
else:

    ans = 1
    i = 0
    while (ans < 10 ** 18):
        ans *= a[i]
        i += 1

    if i == n - 1:
        print(ans)
    else:
        print(-1)


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

if 0 in a:
    print(0)
else:

    ans = 1
    i = 0
    while (i <= n - 1):
        if ans <= 10 ** 18:
            ans *= a[i]
            i += 1
        else:
            break

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


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
ans = 1
count = 0
S = list(map(int, input().split()))

while count <= N - 1:
    ans *= S[count]
    if ans <= 10**18:
        ans = -1
        break
    count += 1
print(ans)

N = int(input())
ans = 1
S = list(map(int, input().split()))

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

N = int(input())
ans = 1
S = list(map(int, input().split()))

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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)

INF = 10**18
N = int(input())
sum = 1
for _ in range(N):
  sum = sum*int(input())
  if sum > INF:
    print(-1)
    import sys
    sys.exit()

print(sum)

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
  if sum > INF:
    print(-1)
    flag = 0
    break
  else:
    pass
    
if flag:
  print(sum)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
nums = list(map(int,input().split()))

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


n = int(input())
nums = sorted(list(map(int,input().split())), reverse=True)

res = 1

if 0 in nums:
  print(0)
  exit()
  
for i in range(n):
  res = res * nums[i]
  if res <= 10**18 :
    continue
  else:
    res = -1
    break
print(res)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
from decimal import *
n = int(input())
a=list(map(Decimal,input().split()))
a.sort()
ans = 1
for i in range(0, n-1):
    ans *= a[i]
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)



from decimal import *
n = int(input())
a=list(map(Decimal,input().split()))
a.sort()
ans = 1
for i in a:
    ans *= i
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)



Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for x in a:
  ans *= x
if x > pow(10, 18):
  print(-1)
else:
  print(x)
  

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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 > 1000000000000000000:
            print(-1)
            finish = 1

if finish = 0:
    print(result)

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
            break

    if finish == 0:
        print(result)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
input()
a = eval(input().replace(' ','*'))
print([a,-1][a>=10**18])

n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a :
    ans = 0

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


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = map(int, input().split())

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

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

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



ans = 0
if 0 not in A:
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = '-1'
      break

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = np.prod(list_A)
if cal > 10e+8:
    cal = -1
print(cal)

N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
#print(list_A)
cal = list_A[0]
for i in range(1,N):
    cal = cal * list_A[i]
if cal > 10e+8:
    cal = -1
print(cal)

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

main()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
def main():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    ans=1
    for i in a:
        ans=ans*i
        if pro>1000000000000000000:
            print(-1)
            return    
    print(ans)
    return
main()            

def main():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    ans=1
    for i in a:
        pro=pro*i
        if pro>1000000000000000000:
            print(-1)
            return    
    print(ans)
    return
main()            

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
a = int(input())

score = 1
for i in range(a):
  b = int(input())
  score *= b
 
if score > 10 ** 18:
  print(-1)
else:
  print(score)

a1 = int(input())
b2 = input().split(" ")

def check(a , b):
  score = 1
  if '0' in b:
    return 0
  else:
    for i in range(a):
      score *= int(b[i])
      if score > 10 ** 18:
        return -1
    
    return score

print(check(a1 , b2))

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))

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

print(ans)

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

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

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A_list = [int(e) for e in input().split()]

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

N = int(input())
A_list = [int(e) for e in input().split()]
A_list.sort(reverse=False)
ans = A_list[0]
for i in range(1,N):
    ans *= A_list[i]
    
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy as np

N = int(input())
A_1n = np.array(list(map(int, input().split())))

if 0 not in A_1n:
	out = np.cumprod(A_1n)[-1]
	print(out) if out < 10 ** 18 else print(-1)
else:
    print(0)

import numpy as np

N = int(input())
A_1n = np.array(list(map(int, input().split())))

if 0 not in A_1n:
	out = np.cumprod(A_1n)[-1]
	print(out) if out < 1e18 else print(-1)
else:
    print(0)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N=int(input())
ans=1
A=list(map(int,input().split()))
while ans<10**18:
    for i in A:
        ans*=i
if ans>=10**18
    print(-1)
else:
    print(ans)

N=int(input())
ans=1
for i in range(N):
  A=int(input())
  ans*=A
if ans>1000000000000000000:
  print(-1)
else:
  print(ans)

def kai():
    N=int(input())
    A=list(map(int,input().split()))
    
    if  0 in A:
        print(0)
        return
    
    ans=1
    for i in A:
        ans*=i
        if ans>10**18:
            print(-1)
            return
    print(ans)
    return
kai()


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

print(n)
print(a)

num = 1
for k in range(n):
	num *= a[k]

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

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

num = 1
if 0 in a:
  num = 0
  
else:
  for k in range(n):
      num *= a[k]
      if num > 10**18:
        num = "-1"
        break

print(num)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
a = map(int, readline().split())
a.sort()
v = 1
for i in a:
  v *= i
  if v > 1000000000000000000:
    print(-1)
    break
  elif v == 0:
    print(0)
    break
else:
  print(v)

import sys
readline = sys.stdin.buffer.readline
n = int(readline())
a = list(map(int, readline().split()))
v = 1

if min(a) == 0:
  print(0)
else:
  for i in a:
    v *= i
    if v > 1000000000000000000:
      print(-1)
      break
  else:
    print(v)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
# -*- coding: utf-8 -*-

from decimal import decimal

a, b = input().split()

print(int(decimal(a)*decimal(b)))


# -*- coding: utf-8 -*-

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

product = 1

if 0 in a_li:
    product = 0
else:
    for i in a_li:
        product *= i
        if product > 10**18:
            product = -1
            break
    break
            
print(product)

# -*- coding: utf-8 -*-

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

product = 1

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

print(product)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
mul = 1
lst = [map(int.input().split())]
for ele in lst:
  mul = mul *ele
if(mul > 1e18):
  print(-1)
else:
  print(mul)

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= i
    if int(ans) in range(10**18):
        print(int(ans))
    else:
        print(-1)

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy as np

N = int(input())
A = list(map(int, input().split())) 
ans = np.prod(A)
ans = -1 if ans >= 1e+18 else ans
print(ans)

import numpy as np

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

FLAG = True
if(min(A) == 0):
    prod = 0
else:
    prod = 1
    for a in A:
        prod *= a
        if(prod > 1000000000000000000):
            print(-1)
            FLAG = not FLAG
            break

if FLAG:
    print(prod)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
l= list(map(int,input().split()))
if 0 in l:
  print(0)
  exit()
ans = 1
for i in l:
  ans *= 1
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
nums  = list(map(int, input().split()))

ans = 1

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

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


import numpy as np

n = int(input())

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

ans = 1

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

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
ans = int(1)
a = input().split(" ")

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

n = int(input())
ans = int(1)
a = input().split(" ")

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

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy as np
 
input()
A = list(map(int, input().split()))
k=np.prod(A)
if k >= 10**(18):
    print(-1)
else:
    print(k)

import numpy as np

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

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

n = input()
A = list(map(int,input().split()))
s = 1
A.sort()
for a in A:
  s *= a
  if s > 10**18:
    s = -1
    break
print(s)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
b = [int(x) for x in input().split()]
a = 1
max = 10**18

for i in b:
  a *= i
  
a = -1 if a > max else a
print(r)

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

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

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

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


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


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N, result = eval(input()), 1
List = list(map(int, input().split()))
if 0 in List:
  print(0)
  quit()
for i in List[N]:
    result *= i
    
print(result if result <= 10**18 else -1)

N, result = eval(input()), 1
List = list(map(int, input().split()))
for i in List[N]:
    result *= i
    
print(result if result <= 10**18 else -1)

n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ans = 1

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


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

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


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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
      break
    elif a[i] == 1:
      break
      
print(ans)

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

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
      break
    elif a[i] == 1:
      break
      
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted