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


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


n=int(input())
l=list(map(int, input().split(' ')))
ans=1
if 0 in l:
    print(0)
else:
    for i in l:
        ans*=i
        if ans>10**18:
            print(-1)
            break
    if not ans>10**18:
        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):
import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A,dtype='int64')

ANS=np.prod(A_N)

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

import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A)

ANS=np.prod(A_N)

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

from operator import mul
from functools import reduce

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

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

import collections
N=int(input())
A=list(map(int, input().split()))
A_dict=collections.Counter(A)
ASN=0
for i in A_dict.keys():
    ANS+=i**A_dict[i]

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

import collections
import sys

N=int(input())
A=list(map(int, input().split()))
A_dict=collections.Counter(A)
ANS=1
if 0 in A_dict.keys():
    print("0")
    sys.exit()
    
for key, value in A_dict.items():
    ANS=ANS*(key**value)
    if ANS>10**18:
        print(-1)
        sys.exit()

print(ANS)


Verdicts: Runtime Error

Wrong Answer

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
limit=1000000000000000000
for i in range (n):
  x=int(input())
  mul*=x
if(mul>limit):
  print(-1)
else:
  print(mul)

n=int(input())
mul=1
limit=1000000000000000000
x=input().split()
for i in range (n):
    p=int(x[i])
    if(p==0):
        mul=0
        break
if(mul==0):
    print(mul)
else:
    for i in range (n):
        p=int(x[i])
        mul*=p
        if(mul>limit):
            break
    if(mul>limit):
      print(-1)
    else:
      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())
values =list(map(int, input().split()))
a=1
 
for i in range(n):
  a=a*values[i]
  
import math
if math.log10(a) < 18:
  print(a)
else:
  print(-1)

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

ans = a[0]
a2 = a[1:]
for i in a2:
  ans = ans * i

if ans > 10e+18:
  ans = -1

print(ans)

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

print(sum(a))

def main():
  n = input()
  a = tuple(map(int, input().split()))

  if 0 in a:
    print(0)
    return
  
  ans = a[0]
  a2 = a[1:]
  for i in a2:
    ans = ans * i
    if ans > 1000000000000000000:
      print(-1)
      return

  print(ans)

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 = [int(i) for i in input().strip.split(" ")]
res=1
xx=1**18
for i in a:
    res*=i
if res>xx:
    print(-1)
else:
    print(res)

N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=1**18
for i in a:
    res*=i
if res>xx:
    print(-1)
else:
    print(res)

N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=10**18
f=0
a.sort()
for i in a:
    res*=i
    if res>xx:
        f=1
        print(-1)
        break

if f==0:
    print(res)

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

tmp = 1
for num in A:
    tmp *= num
    if tmp <= 1e18:
      break
if tmp <= 1e18:
    print(tmp)
else:
    print("-1")


N = int(input())
A = list(map(int, input().split()))
 
tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
  
if tmp <= 1e18:
    print(tmp)
elif 0 in A:
    print(0)
else:
    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):
print(-1)

print(0)

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
if a[0] == 0:
  print(0)
else:
  for i in range(len(a)):
    ans *= a[i]
    if ans > 10**18:
      print("-1")
      exit()
    elif i == len(a)-1:
      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):
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,a = map(int.input().split())
b = list[]
for n:
  b.append(a)

plint(a**n)


n,a = map(int.input().split())
b = list[]
for n:
  b.append(a)

c = a**n
if c > 10**18:
  c = -1
  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 ()


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

seki = 1

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

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

print(seki)

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

seki = 1

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

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

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

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

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

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

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

if 0 in c:
    ans =0
else:
    for i in range(n):
        if ans< max:
            ans=ans*c[i]
            if ans >= max:
                ans =-1
                break
        else:
            ans = -1
            break
print(ans)

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

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

answer = 1
for Ai in A:
    answer *= Ai

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

print(answer)


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

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

answer = 1
for Ai in A:
    answer *= Ai
    if answer > 10 ** 18:
        answer = -1
        break

print(answer)


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 collections import deque
import math
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=1
e=0
f=0
for i in range(n):
  l=a.pop()
  if l == 0:
    s=0
    break
  else:
    s=s*l
    f+=math.log10(s)
    if s>=18:
      e=1
      break
 
if e!=0:
  print(-1)
else:
  print(s)

from collections import deque
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=0
if a.count(0) == 0:
  s=1
  for i in range(n):
    l=a.pop()
    s=s*l      
  
    if len(str(s)) >= 19:
      if s == 10**18 and i==n-1:
        break
      s=-1
      break

    
print(s)

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

#user input A in list
#function of multiplication of all item in list
#time complexity is O(n)
N = int(input())
A = [int(x) for x in input().split()[:N]]

def multiplyList(list1):
    b = 1
    for i in list1:
        b = b*i
    return b

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


a=int(input())
tem = 1

if a != 0:
    b=input().split(" ")
    for i in range(a):
        tem = tem * int(b[i])
    if len(tem)> 10**18:
        tem = -1
print(tem)

# we collect the input A1 upto An.
# limit cannot exceed 10**18
# if N = 0 then ans = 0
# in N is in range then compute 1 * A[n]
N = int(input())
ans = 1
limit = 10 ** 18
length = 0

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

A0 = set(A)
if 0 in A0:
    ans = 0
else:
    pass

for n in range(N):
    ans = ans * A[n]
    if ans == 0:
        break
    elif ans > limit:
        length = 1
        break
    else:
        pass

if length == 1:
    print(-1)
else:
    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):
n = int(input())
a = list(map(int, input().split()))

result = 1

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


#! env/bin/local python3

import sys

n = int(input())
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: x)

result = 1

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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


N=int(input())
A=[]
A=list(map(int,input().split()))
A.sort(reverse=True)
L=10**18
S=1
if A[N-1]==0:
    print("0")
else:
    for i in range(N):
        S=S*A[i]
        if S>L:
            print("-1")
            break
    if S<=L:
        print(S)


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

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


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

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

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

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

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

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

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

Verdicts: 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):
a=input()
a=a.split()

b=int(a[0])

del a[0]

c=1
for x in a:
  c=c*int(x)
  
print(c)  

a=input()
a=a.split()

b=int(a[0])

del a[0]

c=1
for x in a:
  c=c*int(x)
  
if c > 10**18:
  print(-1)
else:  
  print(c) 

s=input()
a=input()
a=a.split()


c=1
for x in a:
  c=c*int(x)
  
if c =< 10**18:
  print(c)
else:  
  print("-1") 


a=int(input())
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
    for x in A:
      ans*=x
      if ans>10**18:
        break


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

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

if ans >= 1000000000000000000:
    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 >= 1000000000000000000:
        ans = -1
        break
    if A[i] == 0:
        ans = 0
        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 *= A[i]
        print(ans)
        if ans > 1000000000000000000:
            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 *= A[i]
        if ans > 1000000000000000000:
            ans = -1
            break

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

N = int(input())

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

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

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

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

print(ans)


import sys

N = int(input())

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

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

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

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


n=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print(0);exit()
for i in range(n):
    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())
a = list(map(int, input().split()))
print(a)
ans = 1
for i in range(len(a)):
    ans *= a[i]
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)


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

if ans <= 1000000000000000000 and not already:
    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):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

n=IN()
a=LI()
p=1
if 0 in a:
    print(0)
    exit()
for i in a:
    p*=i
    print(p)
    if p>pow(10,18):
        print(-1)
        exit()
print(p)


from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

n=IN()
a=LI()
p=1
if 0 in a:
    print(0)
    exit()
for i in a:
    p*=i
    if p>pow(10,18):
        print(-1)
        exit()
print(p)


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())
num_list = 0
for i in range(N):
  a = int(input())
  num_list.append(a)
if 0 in num_list:
  print(0)
else:
  mul = 1
  for a in num_list:
    mul *= a
    if mul > 10**18:
      print(-1)
      sys.exit()
  print(mul)

import sys
N = int(input())
num_list = [int(i) for i in input().split()]
if 0 in num_list:
  print(0)
else:
  mul = 1
  for a in num_list:
    mul *= a
    if mul > 10**18:
      print(-1)
      sys.exit()
  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()))
sum = 1
for i in a:
    if i == 0
    sum = sum * i
    break
    else
    sum = sum * i

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


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

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)



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

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

print(prod)



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

    if 0 in A:
        print(0)

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

    print(prod)


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

val=1
for x in a:
    val*=x

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


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

val=1
for x in a:
    val*=x

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


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

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

print(prod)


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

if 0 in A:
  ans = 0
  N = 0

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

print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

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

input();a=1
for i in input().split():a*=int(i);a=[-1,a][1=<a<=eval('1'+'0'*18)]
print(a)

a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)

a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)

a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)1

a=1
for i in[*open(0)][1].split():a=[-1,a:=a*int(i)][-1<a<=1e18]
print(a)

Verdicts: Wrong Answer

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):
import sys
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

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

print(ans)


import math,sys
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

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

print(ans)


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

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

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

print(ans)


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

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

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

print(ans)


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

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

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

print(ans)


import math,sys
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

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

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

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

n = int(input())
a = list(map(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
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 *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)

Verdicts: Runtime Error

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

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

print(A)

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

if A.count(0) >= 1:
    print(0)
    exit()

answer = 1
for _ in A:
    answer *= _
    if answer > 1000000000000000000:
        print('-1') 
        exit()

print(answer)


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

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

for x in range(N) :
    res = res*A[x]
    if res > 10E+17
        res = -1
        break

print(res)


N = int(input())
A = sorted(map(int, input().split()))
res = 1

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10E+17
        res = -1
        break

print(res)

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

if 0 in A :
    res = 0

for x in range(N) :
    res *= A[x]
    if res > 10**18
        res = -1
        break

print(res)


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

if 0 in A :
    res = 0
    N = 0

for x in range(N) :
    res *= A[x]
    if res > 10**18
        res = -1
        break

print(res)

N = int(input())
A = sorted(map(int, input().split()))
res = 1

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10E+18
        res = -1
        break

print(res)


N = int(input())
A = sorted(map(int, input().split()))
res = 1

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

for x in range(N) :
    res = res*A[x]
    if res > 10E+17
        print(-1)
        break

print(res)

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

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

for x in range(N) :
    res = res*A[x]
    if res > 10E+17
        print(-1)
        break

print(res)

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

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10E+18
        res = -1
        break

print(res)

N = int(input())
A = sorted(map(int, input().split()))
res = 1

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

for x in range(N) :
    res = res*A[x]
    if res > 10E+18
        print(-1)
        break

print(res)


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

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10**18
        res = -1
        break

print(res)


N = int(input())
A = sorted(map(int, input().split()))
ans = 1

if 0 in A :
    ans = 0

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

print(ans)

Verdicts: 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):
N=int(input())
A=[]
result=1
for i in range(N):
  A.append(int(input()))
for j in range(N):
  result=result*A[j]
if(result>10**18):
  print(-1)
else:
  print(result)

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=int(input())
result=1
A=input().split()
for j in range(N):
  result=result*int(A[j])
  if(result>10**18):
    print(-1)
    return
print(result)

N=int(input())
A=[]
result=1
for i in range(N):
  A.append(int(input().split()))
for j in range(N):
  result=result*A[j]
if(result>10**18):
  print(-1)
else:
  print(result)

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

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

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

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 exit

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

tmp=1
for a in A:
	tmp*=a
	if tmp>10**8:
		print("-1")
		exit()

print(tmp)

from sys import exit

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

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

print(tmp)

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

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

print(ans)

import sys
 
n = int(input())
As = list(map(int, input().split()))

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

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

total = 1

if li.index(0):
    total = 0
    print(total)
else:
    for a in li:
        total *= a
        if 10 ** 18 < total:
            total = -1
    print(total)

from operator import mul
from functools import reduce

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

total = 1

if 0 in li:
    total = 0
    print(total)
else:
    total = reduce(mul, [10, 11, 12]) #=> 1320
    if 10 ** 18 < total:
        total = -1
    print(total)

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

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)

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

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

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

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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= 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(intput())
arr=list(input().slpit())
arr.sort();
x=int(1)
for i in arr:
  x=x*i
  if x>1e18:
    x=-1;
    break;
print(x)
  

n=int(input())
arr=list(map(int,input().split()))
arr.sort();
x=int(1)
for i in arr:
  x=x*i
  if x>1e18:
    x=-1;
    break;
print(x)
  


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


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

#print(N)
#print(A)
ans = 1
for i in A:
    #print(i)
    ans *= i
    #print(ans)

if ans >= 10**18:
    print("-1")
    sys.exit()
else:
    print(ans)
    sys.exit()

import sys


N = input()


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

#print(N)
#print(A)
ans = 1
if 0 in A:
    print("-1")
    sys.exit()


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

print(ans)

import sys


N = input()


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

#print(N)
#print(A)
ans = 1
if 0 in A:
    print(0)
    sys.exit()


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

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):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(ans)

def solve(n, a):
    if 0 in a:
        return 0
    lim = 10 ** 18
    ans = 1
    for i in a:
        ans *= i
        print(f'{ans:}')
        if ans > lim:
            return -1
    return ans

if __name__ == '__main__':
    main()

def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(ans)

def solve(n, a):
    if 0 in a:
        return 0
    lim = 10 ** 18
    ans = 1
    for i in a:
        ans *= i
        #print(f'{ans:}')
        if ans > lim:
            return -1
    return ans

if __name__ == '__main__':
    main()

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

data=[int(e) for e in input().split()]

data=data.sort(reverse=False)

judge=True

for i in data:
    sum_1=sum_1*i

    if sum_1>1000000000000000000:
        print("-1")
        judge=False
        break

if judge==True:
    print(sum_1)


import sys

input = sys.stdin.readline

N = int(input())
x = sorted(list(map(int, input().split())))
t = 1

for num in x:
    t = t * num
    if t > 10 ** 18:
        print(-1)
        sys.exit()

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

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


N = input()
A = list(map(int,input().split()))
A.sort()
ans = 1
for a in A:
  ans *= a
  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())
ans = 1
for i in range(0, n):
	t = int(input())
	ans *= t
if ans > int(1e18):
	print(-1)
else:
	print(ans)

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

    if 0 in A:
        print(0)
        return

    ans = 1
    for a in A:
        ans *= a
        if ans > int(1e18):
            print(-1)
            return

    print(ans)

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):
n = int(input())
a = list(map(int, input().split()))
n = int(input())
q = 1000000000000000000
b = 1
cek = True
a = list(map(int, input().split()))
for i in range(n):
	b = b * a[i] 
	if b > q :
		cek = False
		break
if cek :
	print(b)
else :
	print("-1")


n = int(input())
a = list(map(int, input().split()))
n = int(input())
q = 1000000000000000000
b = 1
cek = True
a = list(map(int, input().split()))
for i in range n :
	b = b * a[i] 
	if b > q :
		cek = False
		break
if cek :
	print(b)
else :
	print("-1")


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

q = 1000000000000000000
b = 1
cek = True
zero = a.count(0)
if zero > 0 :
	print("0")
else :
	for i in range(n) :
		b = b*a[i]
		if b > q :
			cek = False
			break
	if cek :
		print(b)
	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())
A = list(map(int, input().split()))

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

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

print(output)


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

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

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

print(output)


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 math

def main(*, int=int, input=input):
    N = int(input())

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

    if 0 in A:
        Alog = [0]
    else:
        Alog = [math.log10(x) for x in A]

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


if __name__ == "__main__":
    import io, sys
    if "_INPUT" in locals():
        sys.stdin = io.StringIO(_INPUT)
    main()

import math

def main(*, int=int, input=input):
    N = int(input())

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

    if 0 in A:
        Alog = [0]
    else:
        Alog = [math.log10(x) for x in A]

    if sum(Alog)>=18:
        print(-1)
    else:
        ans = 1
        for a in A:
            ans = ans * a
        print(ans)
    


if __name__ == "__main__":
    import io, sys
    if "_INPUT" in locals():
        sys.stdin = io.StringIO(_INPUT)
    main()

import math
 
def main(*, int=int, input=input):
    N = int(input())
 
    
    A = list(map(int, input().split()))
 
    if 0 in A:
        print(0)
        return
    else:
        Alog = [math.log10(x) for x in A]
 
    if sum(Alog)>=18:
        print(-1)
    else:
        ans = 1
        for a in A:
            ans = ans * a
        print(ans)
 
if __name__ == "__main__":
    import io, sys
    if "_INPUT" in locals():
        sys.stdin = io.StringIO(_INPUT)
    main()

import math

def main(*, int=int, input=input):
    N = int(input())

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

    if 0 in A:
        print(0)
        return
    else:
        Alog = [math.log10(x) for x in A]

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


if __name__ == "__main__":
    import io, sys
    if "_INPUT" in locals():
        sys.stdin = io.StringIO(_INPUT)
    main()

Verdicts: Time Limit Exceeded

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

multi = 1
i = 0

for n in range(N):
    multi = multi*A[n]
    if multi > 1000000000000000000:
        i = 1
        break

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

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

multi = 1
i = 0

for n in range(N):
    multi = multi*A[n]

if multi > 1000000000000000000:
    print(-1)
else:
    print(0)

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

multi = 1

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

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

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

k = 1

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

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


n = int(input())

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

k = 1

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

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

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

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:
    result = -1
    break
print(result)

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

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

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(input().split())
ans=1
f=0
i=0
while(i<n):
    if f==0:
        ans=ans*int(a[i])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print(0)
        exit()
    i+=2
if f==1:
    print(-1)
    exit()
print(ans)

a,b=map(str,input().split())
b1=int(b*100)
a1=int(a)
ans=int(a1*b1/100)
print(int(ans))

n=int(input())
a=list(input().split())
ans=1
for i in a:
    ans=ans*int(i)
    if f==0 and ans>1000000000000000000:
        f=1
    if int(i)==0:
        f=0
        print(0)
if f==1:
    print(-1)
    exit()
print(ans)

n=int(input())
a=list(input().split())
ans=1
f=0
i=0
while(i<n):
    if f==0:
        ans=ans*int(a[i])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print(0)
        exit()
    i+=1
if f==1:
    print(-1)
    exit()
print(ans)

Verdicts: Wrong Answer

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 = list(map(int,input().split()))
c = 1 
for num in a_list:
  c *= num
print(c)
if len(str(c)) >= 19:
  print(-1)
else:
  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 ()

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

if 0 in x: ans=0

for i in x:
    ans*=i
    print(i,ans)
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)

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

if 0 in x: ans=0

for i in x:
    ans*=i
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)

Verdicts: Wrong Answer

Accepted