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

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

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

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

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

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

print(ans)

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

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

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

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


print(ans)


n=int(input())
lst=list(map(int, input().split()))
ans = 1
if 0 in lst:
    print(-1)
    exit()

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


print(ans)


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

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


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

print(ans)
    


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


print(ans)


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

a.sort()
ans = 1
for i in a:
    ans *= i
    if ans == 0:
        print(0)
        exit()
    if ans > 10**18:
        print(-1)
        exit()
print(ans)


Verdicts: Wrong Answer

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())
li = list(map(int, input().split()))

ans = 1
flag = 0
for i in li:
  ans *= i

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

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


ans = 1
flag = 0
li.sort()
if li[0] == 0:
  print(0)
else:
  for i in li[::-1]:
    ans *= i
    if ans > 10**18:
      flag = 1
      break

  if flag == 0:
    print(ans)
  elif flag == 1:
    print(-1)

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 sys import stdin

n = stdin.readline().rstrip().split()
a = stdin.readline().rstrip().split()

total = 1
for i in a:
    total = total*int(i)
	if(total > 1000000000000000000):
      total = -1
      break
    
print(total)

from sys import stdin
import sys

n = stdin.readline().rstrip().split()
a = stdin.readline().rstrip().split()

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

total = 1
for i in a:
    total = total*int(i)

    if(total > 1000000000000000000):
        print(-1)
        sys.exit()

print(total)

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
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

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

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

import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

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

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

import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

n = int(rl())
a = list(map(int, rl().split()))
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    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):
101 9901 999999000001

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

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()))
A = sorted(A)
A = A[::-1]
ans = 1
for i in range(N+1):
  if 0 in A:
    ans = 0
    break
  elif ans > 10**18:
    ans = -1
    break
  else:
    ans = ans*A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

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

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) 


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

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):
if __name__ == "__main__":
 
    N = int(input())
 
    P = (map(int,input().split()))
 
    mult = 1
    for i in P:
        mult *= i

        
    if (len(str(mult)) > 18):
        print(-1)
    else:
        print(mult)
 


import sys

if __name__ == "__main__":
 
    N = int(input())
 
    P = list(map(int,input().split()))

    if(0 in P):
        print(0)
    else:
        P.sort()

        mult = 1
        for i in P:
            mult *= i 
            if (mult > 10 ** 18):
                print(-1)
                sys.exit()

        print(mult)


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()))
result = 1
for i in range(n):
  result *= a[i]
  if result > 10^(18):
    print(-1)
    break
else:
  print(result)

n = int(input())
a = list(map(int, input().split()))
result = 1
while result <= 10^(18):
  result *= a[i] for i in range(n)
else:
  print(-1)
    
print(result)

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

n = int(input())
a = list(map(int, input().split()))
result = 1
while result <= 10^(18):
  result *= a[i]
else:
  print(-1)
    
print(result)

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

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

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

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

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

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

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

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

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

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

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

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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 = list(map(int,input().split()))
ans = 1
for i in a_list:
    ans *= i
    if ans <= 10**18:
        print(-1)
        exit()
print(ans)

n = int(input())
a_list = list(map(int,input().split()))
if 0 in a_list:
    print(0)
    exit()
ans = 1
for i in a_list:
    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 main():
	list = []
	n = int(input())
	for i in range (0,n):
		ele = int(input())
		list.append(ele)
	list.sort()
	ans = int(1)
	b = 0
	for i in range (0, n):
		ans = ans * list[i]
		if int(ans) > int(1000000000000000000):
			print(-1)
			return
	print(ans)
	return

if __name__ == "__main__":
  
  main()

def main():
	n = int(input())
	list1 = [int(t) for t in input().split()]
	list1.sort()
	ans = 1
	b = 0
	for i in range (0, n):
		ans = ans * list1[i]
		if int(ans) > int(1000000000000000000):
			print(-1)
			return
	print(ans)
	return

if __name__ == "__main__":
  
  main()

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

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

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: 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):
# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
res = -1 if math.log10(res) > 18 else res
print(res)

# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
if res > 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
if res != 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
res = 1 
if 0 in a:
  res = 0
else:
  for num in a:
    res *= num
    if res > 10**18:
      res = -1
      break
print(res)

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):
# -*- coding: utf-8 -*-


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

if not finished:
    print(str(r))

# -*- coding: utf-8 -*-
import sys

input()
l = list(map(lambda x: int(x), str(input()).split(" ")))
r = 1
finished = False

for i in l:
  if i == 0:
    print(str(0))
    sys.exit()
    
for i in l:
    r = r * i
    if r > 10 ** 18:
        print(str(-1))
        sys.exit()

print(str(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 = map(int, input().split())
if 0 in a:
  print(0)
else:
  result = 1
  for i in a:
    result *= i
    if result > 10**18:
      print(-1)
      break
  else:
    print(result)

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

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 = 1
for i in range(0, n):
  b = int(input())
  ans *= b
if a > 10**18:
   print(-1)
else:
  print(ans)
  



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



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

if 0 in a:
  print(0)
  
else:
  ans = 1
  for val in a:
    ans *= val
    if ans > 10**18:
      print(-1)
      exit()
      
  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):
def fun():
	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)



fun()

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

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):
a = int(input())
b = list(map(int, input().split()))
c = 1

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

for n in b:
    c = c*n
    if c > 10**18:
        print(-1)
        exit()

print(c)

a = int(input())
b = list(map(int, input().split()))
c = 1

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

for n in b:
    c = c*n
    if c > 10**18:
        print(-1)
        exit()

print(c)

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
A = list(map(int, input().split()))

for i in range(N):
  ans = ans * A[i]
  if ans = 0:
    break

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

N = int(input())
ans = 1
A = list(map(int, input().split()))
flag = 0

for j in range(len(A)):
  if A[j] == 0:
    flag = 1
    ans = 0

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


if ans > 10 ** 18:
  print('-1')
else:
  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):
num = int(input())
nums = input().split()

zero_flag = False
for item in nums:
  if item == '0':
    zero_flag = True
    break
    
if zero_flag:
  seki = 0
else:
  seki = 1
  for item in nums:
    seki *= int(item)
    print(seki)
    if seki > 10**18:
      seki = -1
      break

print(seki)

num = int(input())
nums = input().split()

zero_flag = False
for item in nums:
  if item == '0':
    zero_flag = True
    break
    
if zero_flag:
  seki = 0
else:
  seki = 1
  for item in nums:
    seki *= int(item)
    if seki > 10**18:
      seki = -1
      break

print(seki)

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):
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())

A = np.arrya(list(map(int, input().split())))
mul = np.prod(A)

if mul > 1000000000000000000:
    print(-1)
    exit(-1)
print(mul)

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

import numpy as np

N = int(input())

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

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

mul = A[0]

for i in A[1:]:
    if 1000000000000000000 / i < mul:
        print(-1)
        exit(0)
    mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(0)

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

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

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

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 = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        ans = ans*A[i]
        if(ans > 10*:18):
            print(-1)
            break
        elif(i == N-1):
            print(ans)

N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        ans = ans*A[i]
        if(ans > 10**18):
            print(-1)
            break
        elif(i == N-1):
            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):
a,b=open(0);c=1;
for i in range(int(a)):c*=int(b[2*i])
if c>10**18:print(-1);exit()
print(c)

a,b=open(0);c=1;
for i in b.split():c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c)

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 :
  print(0)
  exit()
for i in a:
  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 :
  print(0)
  exit()
for i in a:
  ans *= 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 = list(map(int,input().split()))
ans = 1
print(A)
for v in A:
    ans = ans * v
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)    

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

N = int(input())
A = list(map(int,input().split()))
ans = 1
if 0 in A:
    ans = 0
else:
    for v in A:
        ans = ans * v
        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):
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit()
ans = 1
for i in A:
  ans *= i
  if ans >= 10 ** 18:
    print(-1)
	exit()
print(ans)

         

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


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


N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit(0)
ans = 1
for i in A:
  ans *= i
  if ans >= 10 ** 18:
    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 A:
  ans *= i
  if ans > 10 ** 18:
    print(-1)
    exit(0)
print(ans)


Verdicts: Runtime Error

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):
x, y = input().split()
x = int(x)
y = int(y.replace(".", ""))
print((x*y)//100)

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

A.sort()
ans = 1
flag=False
for a in A:
  ans *= a
  if ans > 1e18:
    flag=True
    break
if flag:
  print(-1)
else:
  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(map(int, input().split()))
A = sorted(A)
ans = 1
for i in range(N):
    ans *= A[i]
    if (ans >= 10 ** 18):
        print(-1)
        exit()
        break

print(ans)

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
ans = 1
for i in range(N):
    ans *= A[i]
    if (ans > 10 ** 18):
        print(-1)
        exit()
        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):
import numpy as np


import numpy as np
from decimal import Decimal

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

A = np.array(a)
a_mul = Decimal(int(np.prod(A)))

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


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

def Answer(a):
    if 0 in a:
        return(0)

    ans = 1

    for i in a:
        ans *= i
        if ans > 10 ** 18:
            return(-1)

    return(ans)

print(Answer(a))


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 = input()
a = input().split(' ')
def doit(a):
  m = 1
  for ai in a:
  	if m > 10**18:
      return -1
    m = m*a
  
  return m

doit(a)


n = int(input())
a = list(input().split(' '))
# print(n, a)
def doit(n,a):
  m = 1
  for i in range(n):
    m = m*int(a[i])
    if m > 1000000000000000000:
        for y in range(i+1, n):
            if a[y] == '0':
                return 0
        return -1
    elif m==0:
        return 0

#   if m > 1000000000000000000:
#     return -1
  return m
 
print(doit(n,a))


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

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
    
if 0 in A:
  print(0)
else:
  print(ans)

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

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

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

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):
a = int(input())
ar = list(map(int,input().split(" ")))
b = 1
for r in ar:
  b *= r
  if b >= 10 ** 18:
    print(-1)
    exit()
print(b)

a = int(input())
ar = list(map(int,input().split(" ")))
if 0 in ar:
    print(0)
    exit()
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        exit()
print(b)

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
n = int(input())
a =[ [int(c) for c in l.split()] for l in sys.stdin]
a =a[0]
m = 1

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


import sys
n = int(input())
a =[ [int(c) for c in l.split()] for l in sys.stdin]
a =a[0]
m = 1

for i in range(n):
 m=m*a[i]

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

import sys
n = int(input())
a =[ [int(c) for c in l.split()] for l in sys.stdin]
a =a[0]
m = 1

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

print(m)

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 = list(map(int,input().split()))

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

if ans >= 1e+18:
  print(-1)
else:
  print(ans)

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

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

if ans >= 1e+18:
  print(-1)
else:
  print(ans)

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

ans = 1

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

print(ans)

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

N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
if(A[-1]==0):
    print(0)
else:
    ans=1
    flag=0
    for i in range(N):
        ans=ans*A[i]
        if(ans>10**18):
            flag=1
            break
    if(flag==0):
        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):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans = np.prod(a)
if ans // 10**18 == 0:
  print(ans)
else:
  print(-1)

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


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

ans = 1

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

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


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

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

ans = 1

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

print(ans)

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

ans = 1

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


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

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

ans = 1

if 0 in A:
    print(0)
    exit:

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


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

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

ans = 1

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

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


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

Verdicts: Runtime Error

Runtime Error

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())
a = list(map(int, input().split()))

ans = 1
flag = True
for i in a:
  ans *= i
  if ans >= 10**18:
    print(-1)
    flag = False
    break

if flag:
  print(ans)

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

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

n = int(input())
a = list(map(int, input().split()))
limit = 10**18
ans = 1




flag = True

if 0 in a:
  print(0)
  flag = False

if flag:
  for i in a:
    ans *= i
    if ans >= limit:
      print(-1)
      flag = False
      break

if flag:
  print(ans)
  
  

n = int(input())
a = list(map(int, input().split()))
limit = 10**18
ans = 1




flag = True

if 0 in a:
  print(0)
  flag = False

if flag:
  for i in a:
    ans *= i
    if ans > limit:
      print(-1)
      flag = False
      break

if flag:
  print(ans)
  
  

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)
  exit()
total = 1 
for i in range(n):
  total * = a[i]
  if total > 10 ** 18:
  ans = -1
  break
print(total)



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

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

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


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

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

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

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

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

print(total)


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

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


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

Verdicts: 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):
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)


import math

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

hoge =1
for num in arr:
    hoge = hoge*num

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


import math

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

hoge =1

if 0 in arr:
    print(0)

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


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):
#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
flag = True
for i in A:
    if flag:
        ans *= i
        if ans > 10**18:
            ans = -1
            flag = False
    else:
    if i == 0:
        ans = 0
print(ans)


#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
flag = True
for i in A:
    if flag:
	    ans *= i
		if ans > 10**18:
    		ans = -1
            flag = False
	else:
		if i == 0:
          ans = 0
print(ans)


import numpy as np
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1

for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        print(ans)
        break
else:
    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())
A = list(map(int,input().split()))

if 0 in A:
  print(0)
  return

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

print(count)


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

if 0 in A:
  print(0)
  return

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

print(count)

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

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

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

main()


Verdicts: Runtime Error

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 = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        mul = -1
        break

print(-1)

n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        mul = -1

print(-1)

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


prod = 1
for a in A:
  if a == 0:
    prod = 0
  prod *= a
  if prod > 1000000000000000000:
  prod = -1

print(prod)

n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        break

print(-1 if mul >= 1e18 else mul)


n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a

print(-1 if mul >= 1e18 else mul)


def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    if 0 in A:
        print(0)
        return

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

        if mul > 1e18:
            print(-1)
            return

    print(mul)


main()

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

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()))
max = 10 ** 18
res = 0

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

print(res)

n = int(input())
a = list(map(int, input().split()))
max = 10 ** 18
res = 0

for i in range(n):
    res *= a[i]
    if res > max:
        print(-1)
        sys.exit()

print(res)

import sys
n = int(input())
a = list(map(int, input().split()))
limit = 10 ** 18
res = 1

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

for i in range(n):
    res *= a[i]
    if res > limit:
        print(-1)
        sys.exit()

print(res)

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 = list(map(int,input.split()))
a = sorted(a)
prod = 1
for x in a:
  prod *= x
  if prod > 10**18:
    prod = -1
    break
print(prod)

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

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

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

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

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

ans =1

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

N = int(input())
A =[map(int,input().split())]

ans =1

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

print(ans)

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

ans =1

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

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

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

ans =1

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

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


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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
  result *= a
  if result > limit:
    print(-1)
    exit()
print(result)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

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


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

n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
c=int(1e18)
if 0 in seq:
    print(0)
else:
    for i in range(n):
        p*=seq[i]
        if p>c:
            print(-1)
            f=0
            break
            
    if f==1:
        print(p)



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

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)

import numpy as np

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

ans=np.prod(A)

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

import  numpy as mul
import math

N=int(input())
A=[]
for i in range(N):
	A.append(list(map(int,input().split())))


ans=mul.prod(pyA)


if int(math.log10(ans)) > 17:
	print("-1")
	
else:
	print(ans)

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)

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)

import  numpy as mul
import math

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

if int(math.log10(ans)) > 17:
	print("-1")
else:
	print(ans)

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

ans=1
if 0 in A:
    ans = 0
else:
    A.sort(reverse=True)
    for a in A:
        if a > 10**18:
            ans = -1
            break
        else:
            ans *= a
            if ans > 10**18:
                ans = -1
                break
print(ans)

                


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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())
a = [map(int, input().split()) for _ in range(n)]

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

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

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

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

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

n=int(input())
arr=list(map(int,input().split()))
arr=sorted(arr) 
ans=1
for val in arr:
 ans*=val 
 if ans>10**18:
   print(-1)
   break
else:
 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):
num=int(input())
line=input().split(" ")
checklis=sorted(line)
if checklis[0]=="0":
    res=0
else:
    res=1
    i=0
    while res<=1000000000000000000 and i<num:
        res *= int(line[i])
        print(res)
        i+=1
        
    if res>1000000000000000000:
        res= -1
 
print(res)


num=int(input())
line=input().split(" ")
checklis=sorted(line)
if checklis[0]=="0":
    res=0
else:
    res=1
    i=0
    while res<=1000000000000000000 and i<num:
        res *= int(line[i])
        i+=1
        
    if res>1000000000000000000:
        res= -1
 
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):
n = int(input())
a = map(int, input().split())
sum = 1
for x in a:
  sum *= a
  if sum > 1e18:
    sum = -1
    break
print(sum)


n = int(input())
a = map(int, input().split())
sum = 1
for x in a:
  sum *= x
  if sum > 1e18:
    sum = -1
    break
if 0 in a:
  sum = 0
print(sum)


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 math


def main():
    N = int(input())
    A = [int(arg) for arg in input().split()]
    ans = 1
    for i in range(N+1):
        ans *= A[i]
        if ans > pow(10, 18) and i == N:
            ans = "-1"
            break

    print(ans)


if __name__ == '__main__':
    main()


import math


def main():
    N = int(input())
    A = [int(arg) for arg in input().split()]
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans >= pow(10, 18):
            ans = "-1"
            break

    print(ans)


if __name__ == '__main__':
    main()



def main():
    N = int(input())
    A = [int(arg) for arg in input().split()]
    ans = 1

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

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

    print(ans)


if __name__ == '__main__':
    main()


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

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

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

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

Verdicts: Wrong Answer

Accepted