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

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

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 a in A:
    ans = ans * a

if len(str(ans)) >= 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 a in A:
    ans = ans * a
    if len(str(ans)) >= 18:
        print(-1)
        exit()
print(ans)

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

if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans = ans * a
    if ans > pow(10, 18):
        print(-1)
        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):
# coding: utf-8
# Your code here!
N = int(input())
line=list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
    if a>=1000000000000000000:
        for j in range(i,N):
            if line[j]==0:
                print(0)
                b=1
                break
                
        if b==0:    
            print(-1)
            b=1
        else:
            break
if b==0:
    print(a)


# coding: utf-8
# Your code here!
N = int(input())
line=list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
if a>=1000000000000000000:
    print("-1")
else:
    print(a)

# coding: utf-8
# Your code here!
N = int(input())
line=list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
    if a>=100000000000000000:
        for j in range(i,N):
            if line[j]==0:
                print(0)
                b=1
                break
                
        if b==0:    
            print(-1)
            b=1
        else:
            break
if b==0:
    print(a)

# coding: utf-8
# Your code here!
N = int(input())
line = list(map(int,input().split()))
a=1
b=0
for i in range(N):
    a*=line[i]
    if a>1000000000000000000:
        for j in range(i,N):
            if line[j]==0:
                print("0")
                b=1
                break
            if j==N-1:
                print(-1)
                b=1
                break
        break
       
if b ==0:
    print(a)

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

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

Verdicts: Wrong Answer

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
from collections import deque

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

if n%2==0:
	ans=1
	for i in range(n/2):
		ans=ans*a[i]*a[i+n/2]
else:
	if n==1:
		ans=a[0]
	else:
		ans=a[0]
		for i in range(1,int((n-1)/2)+1):
			ans=ans*a[i]*a[i+int((n-1)/2)]

if ans>1000000000000000000:
	print("-1")
else:
	print(ans)

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

if n%2==0:
	ans=1
	for i in range(n/2):
		ans=ans*a[i]*a[i+n/2]
else:
	if n==1:
		ans=a[0]
	else:
		ans=a[0]
		for i in range(1,int((n-1)/2)+1):
			ans=ans*a[i]*a[i+int((n-1)/2)]

if ans>1000000000000000000:
	print("-1")
else:
	print(ans)

import sys

def main():
    n = int(input())
    a=sys.stdin.readline().rstrip().split()
    if '0' in a:
        print(0)
        return
    ans=1
 
    for i in a:
        ans=ans*int(i)
        if ans>1000000000000000000:
            print("-1")
            return
    else:
        print(ans)
main()

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18:
    prod=1
    for i in A:
        prod=prod*i
    if prod<1e18:
        print(prod)
else:
    print('-1')

import math
N=int(input())
A=list(map(int,input().split()))
x=0
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18.1:
    prod=1
    for i in A:
        prod=prod*i
    if prod<1e18:
        print(prod)
else:
    print('-1')


import math
N=int(input())
A=list(map(int,input().split()))
x=0
y=False
if 0 in A:
    y=True
    A.remove(0)
for i in A:
    x+=math.log(i,10)
if y==True:
    print(0)
elif x<=18.1:
    prod=1
    for i in A:
        prod=prod*i
    if prod<1e18:
        print(prod)
else:
    print('-1')

N=int(input())
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
    print('0')
    A.remove(0)
    exit()
prod=1
for i in A:
    prod=prod*i
    if prod>1e18:
        print('-1')
        exit()
else:
    print(prod)

Verdicts: 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):
s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
if ans > 1000000000000000000:
  print(-1)
else:
 	print(ans)

n = input()
s = input().split(" ")
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:	
  print(ans)

n = input()
s = input().split(" ")
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print("-1")
else:	
  print(ans)

s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

n = input()
s = input().split(" ")
ans = 1
for i in s:
  ans *= i
print(ans)

n = input()
s = input().split(" ")
ans = 1

if "0" in s:
  print(0)
else:
  for i in s:
    ans *= int(i)
  if ans >= 1000000000000000000:
    print("-1")
  else:
    print(ans)




s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
  
 print(ans)

n = input()
s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

n = input()
s = input()
s = s.split()
ans = 1
for i in range(n):
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

n = input()
s = input()
s = s.split(" ")
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

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



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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

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

total = 1
for n in A:
    if total <= 10 ** 18:
        total *= n
        print(total)
    else:
        print(-1)

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

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

Verdicts: Wrong Answer

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

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

prod = np.prod(A)

if prod <= 10^18:
    print(prod)
else:
    print(-1)

import numpy as np
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

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

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 = ans * i
if ans > 10**18:
    print("-1")
else:
    print(an

import sys

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
ans = 1
for i in a:
    if i == 0:
        print(0)
        sys.exit()
    ans *= 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 = int(input())

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

ans = 1

for item in A:
    ans *= item

    ans = min(ans, 10**18)

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

print(ans)

N = int(input())

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

ans = 1

for item in A:
    ans *= item

    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    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):
import sys
N=int(sys.stdin.readline()) 
values = []
res = 1
while N :
	values=(sys.stdin.readline().split())
	for v in values:
      res *= v
    if res > 10e18:
      print(-1)
    else
      print(res)
    
      

import sys
N=int(sys.stdin.readline())
values = []
res = 1
values=sys.stdin.readline().split()
for v in values:
    if int(v) == 0:
        print(0)
        exit(0)

for v in values:
    res *= int(v)
    if res > 1000000000000000000:
        print(-1)
        exit(0)
print(res)


Verdicts: Runtime Error

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

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


n = int(input())
a = list(map(int,input().split()))
max_val = 10 ** 18
ans = 1
z_count = a.count(0)
for i in a:
    if z_count >= 1:
        ans = 0
        break
    ans *= i
    if ans > max_val:
        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):
from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
	if prod > 1000000000000000000:
		write('-1\n')
		return
	write (str(prod) + '\n')

main()

from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 10 ** 18:
			write('-1\n')
			return
	write (str(prod) + '\n')

main()

from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 10 ** 18:
			write('-1\n')
			return
	if prod <= 10**18:
		write (str(prod) + '\n')

main()

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

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

def main():
	n = int(input())
	a = map(int,input().split())
	if 0 in a:
		print (0)
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 10 ** 18:
			print(-1)
			return
	if prod <= 10**18:
		print (prod)
	else:
		print (-1)

main()

n = int(input())
a = [int(x) for x in input().split()]
prod = 1
for i in range(n):
	if a[i] == 0:
		prod = 0
		break
	else:
		prod *= a[i]
if prod >= int(1e18):
	print(-1)
else:
	print (prod)

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

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

Verdicts: Wrong Answer

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

for k in a:
    if k == 0:
        print(0)
        exit()

maxn = 10**18
ans = 1
for k in a:
    ans *= k
    if ans > maxn:
        ans = -1
        break


print(ans)


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

for k in a:
    if k == 0:
        print(0)
        exit()

maxn = 10**18
ans = 1
for k in a:
    ans *= k
    if ans > maxn:
        ans = -1
        break


print(ans)


Verdicts: Wrong Answer

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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
from sys import exit
n = int(input())
a = list(map(int, input().split()))
a.sort(Reverse = True)
ans = 1
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)


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


Verdicts: Runtime Error

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

Submission attempts (in order):
n=int(input())
x = [int(i) for i in input().split()]
print(x)
mul=1
check=10**18
count=x.count(0)
if(count>=1):
    print("0")
else:
    for i in range(n):
        mul*=int(x[i])
        if(check<mul):
            break
    if(check<mul):
        print("-1")
    else:
        print(mul)

n=int(input())
x = [int(i) for i in input().split()]
mul=1
check=10**18
count=x.count(0)
if(count>=1):
    print("0")
else:
    for i in range(n):
        mul*=int(x[i])
        if(check<mul):
            break
    if(check<mul):
        print("-1")
    else:
        print(mul)

Verdicts: Wrong Answer

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

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

t()

def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())


def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
            break
        return -1
t()

def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
    return T
t()

N = int(input())
A = list(map(int, input().split()))
T = 1
for i in A:
    T *= i

def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
t()

def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())     
                                                                                                     

def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())


def t()
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        T *= i
    if T > 10 ** 18:
        print(-1)
    else:
        print(T)

t()

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

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

Submission attempts (in order):
t = int(input())
lst = map(int,raw_split())
sum = 0
for i in range(t):
  sum *= lst[i]
if(sum <= 10000000000000000000000000000000000000000000):
  print(sum)
else:
  print(-1)
  

import sys
inp = int(input())
lst = list(map(int,input().split()))
sum = 1
if 0 in lst:
    print(0)
    sys.exit(0)
else:
    num = 1;
    for i in range(inp):
        num *= lst[i]
        if num > 10 ** 18:
            print("-1")
            sys.exit()
    print(num)

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

print(ans)

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

if ans>10**18:
        print(-1)
        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):
import array


n = int(input())
a=[]
f=0
f1=0
b=0
for i in range(0,n):
    i = int(input())
    a.append(i)
    if i == 0:
        print("0");
        f1=1
        

sum =1
if f1==0:
    for i in a:
        sum=sum*i;
        if sum>1e18:
            f=1
            print("-1");
    
if f==0:
    print(sum)

import array


n = int(input())
a=[]
a=input().split(" ")
f=0
f1=0
b=0
for i in a:
    if int(i) == 0:
        print("0")
        f1=1
        break
        

sum =1
if f1==0:
    for i in a:
        sum=sum*int(i)
        if sum>1e18:
            f=1
            print("-1")
            break
    


if f==0 and f1==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):
n= int(input())
a=list(map(int,input().split()))
ans = 1
if not 0 in a:
  for i in range(n):
    ans*=a[i]
    if ans>1e+18:
      print(-1)
      break     
  if ans<=1e+18:
    print(ans)
eles:
  print(0)

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

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):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    if ans>=10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)


ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    print(ans)
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)


ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    #print(ans)
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)


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())
L = [int(i) for i in input().split()]
ANS=1
for i in range(len(L)):
    ANS=ANS*L[i]
if ANS>=100000000000000000:
    print(-1)
else:
    print(ANS)

# coding: utf-8
# Your code here!
N=int(input())
L = [int(i) for i in input().split()]
ANS=1
flag=0
for i in range(N):
    if L[i]==0:
        print(0)
        flag=1
        break
if flag==0:
    for i in range(N):
        ANS=ANS*L[i]
        if ANS>=1000000000000000001:
            print(-1)
            break
        if i==N-1:
            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 = input().split(" ")
result = 1
for i in range(N):
  result *= int(A[i])
  if result >= 10**18:
    print(-1)
    exit()
print(result)

N = int(input())
A = input().split(" ")
result = 1
if "0" in A:
  print(0)
  exit()
else:
  for i in range(N):
    result *= int(A[i])
    if result > 10**18:
      print(-1)
      exit()
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):
arr=list(map(int, input().split()))
mul=1
done=False
for i in range(0, len(arr)):
  mul*=arr[i]
  if mul>int(1e18):
    print("-1")
    done=True
    break
if not done:
  print(mul)

n=int(input())
arr=list(map(int, input().split()))
if 0 in arr:
  print("0")
else:
  done=False
  mul=1
  for i in range(len(arr)):
    if mul*arr[i]<=int(1e18):
      mul*=arr[i]
    else:
      print("-1")
      done=True
      break
  if not done:
    print(mul)


Verdicts: Wrong Answer

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

Submission attempts (in order):
import math

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

flag_zero=0
sum = 0
for i in range(n):
  if a[i]==0:
    flag_zero=1
  else:
    sum += math.log10(a[i])

if flag_zero == 1:
  print(0)
elif sum >= 18:
  print(-1)
else:
  sum = 1
  for i in range(n):
    sum *= a[i]
  print(sum)


import math

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

flag_zero=0
sum = 0
for i in range(n):
  if a[i]==0:
    flag_zero=1
  else:
    sum += math.log10(a[i])

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


import math

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

sum = 0
for i in range(n):
  sum += math.log10(a[i])

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


import math

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

flag_zero = 0
sum = 0
for i in range(n):
  if a[i]==0:
    flag_zero = 1
  else:
    sum += math.log10(a[i])

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


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):
import numpy as np

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

ketas=[]
for s in sA:
    ketas.append(len(s))

length=sum(ketas)

S=A[0]
flag=False

zero=False
for i in range(N):
    if(A[i]==0):
        zero=True
        break

if(length>18):
    flag=True
else:
    for i in range(1,N):
        S*=A[i]

if(zero):
    print(0)
else:
    if(flag):
        print(-1)
    else:
        print(S)


N=int(input())
sA=input().split(" ")
A=[]

for i in range(N):
    A.append(int(sA[i]))

flag=False

zero=False
th=pow(10,18)
for i in range(N):
    if(A[i]==0):
        zero=True
        break
    elif(A[i]>th):
        flag=True
        break

S=1
for i in range(N):
    S*=A[i]
    if(S>th):
        flag=True
        break

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

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


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

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


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


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

res = 1
check = 10**18
if 0 in l:
  res = 0
else:
    for e in l:
      res *= e
      if res >= check:
          res = -1
          break
print(res)

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

res = 1
check = 10**18

for e in l:
    res *= e

if res >= check:
	print(-1)
else:
	print(res)

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

res = 1
check = 10**18

for e in l:
  res *= e
  if res >= check:
      res = -1
      break
print(res)

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

res = 1
check = 10**18
flag = 0 in l

for e in l:
    res *= e
    if res > check:
        if flag:
            res = 0
        else:
            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):
from operator import mul
from functools import reduce

li = list(map(int,input().split()))	
x=reduce(mul, li)
if x>=10**18:
  print("-1")
else:
  print(x)

from operator import mul
from functools import reduce
N=int(input())
li = list(map(int,input().split()))	
if reduce(mul, li)>=10**18:
  print("-1")
else:
  print(reduce(mul, li))

from operator import mul
from functools import reduce

N=int(input())
li = list(map(int,input().split()))	
x=reduce(mul, li)
if x>=10**18:
  print("-1")
else:
  print(x)

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

result = As[0]
if 0 in As:
    print(0)
else:
    for i in range(n-1):
        result = result*As[i+1]
        if result > 10**18 :
            print(-1)
            break
        else:
            continue
    if result <= 10**18 :
        print(result)

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

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

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


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

Verdicts: 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):
def main():
    n=int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return

    ans=1
    for i in A:
        ans*=i
        if ans>1000000000000000000:
            print(-1)
            return

    print(ans)

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

    ans=1
    for i in A:
        ans*=i
        if ans>1000000000000000000:
            print(-1)
            return

    print(ans)

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

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

for a in A:
    ans *= a
    if 1000000000000000000 < ans:
        print(-1)
        exit()

print(ans)

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

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

for a in A:
    ans *= a
    if 1000000000000000000 < ans:
        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():
    N = int(input())
    A = map(int,input().split())
    result = 1
    if 0 in A:
        print(0)
        return

    for i in A:
        result *= i

    if result > 1000000000000000000:
        print(-1)
        return
    print(result)

main()


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

result = 1
for i in range(len(A)):
    result *= A[i]

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


def main():
    N = int(input())
    A = map(int,input().split())
    result = 1
    if 0 in A:
        print(0)
        return

    for i in A:
        result *= i
        if result > 1000000000000000000:
            print(-1)
            return
    print(result)

main()

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

result = 1
for i in range(len(A)):
    result *= A[i]

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

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

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

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

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

x = 1
for i in range(N):
    x = x * l[i]

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

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

x = 1
for i in range(N):
    x = x * l[i]

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

import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

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

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

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

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

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

Verdicts: Runtime Error

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

mul = 1

for num in listed:
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10:
      mul = -1
print(mul)

listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10:
      mul = -1
print(mul)

def ans(lst):
  if 0 in lst:
    return 0
  n = 1
  for i in lst:
    n *= i
    if n > 10**18:
      return -1
  return n
input()
A = input().split(' ')
A = [int(x) for x in A]
print(ans(A)) 

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

A = sorted(A)
result = 1
max = 10**18
for a in A:
    result *= a
    if result > max:
        print(-1)
        break
    else:
        print(result)

N = int(input())
A = input().split()

result = 1

for num in range(N):
    result = result * int(A[num])

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

A = sorted(A)
result=1
max=10**18
for a in A:
    result *= a
    if result>max:
        print(-1)
        break
else:
    print(result)

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 = 1
flag = False
for _ in range(n):
  d = int(input())
  a *= d
  if a > 10**18:
    flag = True
    break
if flag:
  print(-1)
else:
  print(a)

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

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

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)

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

ans = 1
for i in range(N):
  ans *= a[i]
  if ans >= 10**18:
    print(-1)
    exit()
  elif ans == 0:
    print(0)
    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):
  ans *= a[i]
  if ans > pow(10,18):
    print(-1)
    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):
a,b = map(float,input().split())
ans = ((a*b*100) /100)// 1
print(int(ans))

n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
    ans = min(ans,10**18 + 1)
if ans >= 10**18 + 1:
    ans = -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):
import math
n= int(input())

l = list(map(int,input().split()))
l.sort(reverse = True)
print(l)
ans = 1
if 0 in l:
  print(0)
else:
  for i in range(n):
    ans *= l[i]
#    print(ans)
    if ans > 10**18:
      break
  print(ans if ans <= 10**18 else -1)


import math
n= int(input())

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

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

print(ans)


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

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

    if az>0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)


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

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

    if a0>0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)


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

    print(ans)


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

if az>0:
    print(0)
else:
    for i in range(len(a)):
        ans*= a[i]
    
        if ans>=1000000000000000001:
            ans=-1
            break
    print(ans)


Verdicts: Wrong Answer

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):
#!/usr/bin/env python3

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    
    out = 1
    for n in A:
        out = n * out
    if out >= 1000000000000000000:
        print(-1)
    else:
        print(out)



main()

#!/usr/bin/env python3

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

    if 0 in A:
        print(0)
    else:
        out = 1
        for n in A:
            out = n * out
            if out > 1000000000000000000:
                break
            else:
                continue
    
        if out > 1000000000000000000:
            print(-1)
        else:
            print(out)


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())
sum = 1
for i in range(N):
  a = int(input())
  sum = sum * a
print(sum)

N = int(input())
line = [int(i) for i in input().split()]
sum = 1
line.sort(reverse=True)
if line[len(line) -1]== 0:
  print(0)
  exit()
for num in line:
  sum = sum * num
  if sum > 10 ** 18:
    print(-1)
    exit()
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())
lista = list(map(int, input().split()))
limitNumber = 10**18
ans = 1

if 0 in lista:
    ans = 0
else:
    lista.sort(reverse=True)
    print(lista)
    for i in range(n):
        ans *= lista[i]
        if(ans > limitNumber):
            ans = -1
            break

print(ans)


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

if 0 in lista:
    ans = 0
else:
    lista.sort(reverse=True)
    for i in range(n):
        ans *= lista[i]
        if(ans > limitNumber):
            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())
alist=list(map(int, input().split()))
ans=1
for i in range(n):
  while ans<=10**18:
    ans*=alist[i]
if 0 in alist:
  ans=0
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]
  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()))
m=1

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

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



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

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




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

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




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

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




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

ans = 1
var = pow(10,18)
for i in range(len(A)):
    ans *= A[i]
    if ans > tmp:
        ans = -1
        break

print(ans)

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

ans = 1
var = pow(10,18)

if 0 in A:
    ans = 0
else:
    for i in range(len(A)):
        ans *= A[i]
        if ans > var:
            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):
a = []
x = 1

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

for i in range(n):
    a[i-1] = int(a[i-1])
    x = x * a[i-1]
    
    if x <= 10**18 and i == n:
            print(x)
    else:
        print(-1)

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

for i in range(n):
  ans = ans * a[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):
import sys

N = int(input())
As = set(int(n) for n in input().split())

limit = 10**18

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

prod = 1
for A in As:
    prod *= A
    if prod > limit:
        print(-1)
        sys.exit(0)

print(prod)

import sys

N = int(input())

As = [int(n) for n in input().split()]
As_set = set(As)

limit = 10**18

prod = 1

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

over = False
for A in As:
    prod *= A
    if prod > limit:
        print(-1)
        sys.exit(0)

print(prod)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
l=list(map(int,input().split()))
a=1
l.sort()
print(l)
for i in range(N):
  a=a*l[i]
  if a>10**18:
    print(-1)
    break
if a<=10**18:
  print(a)


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


Verdicts: Wrong Answer

Accepted