Problem:


Score : 200 points

Problem Statement

Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.

However, if the result exceeds 10^{18}, print -1 instead.

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

Print the value A_1 \times ... \times A_N as an integer, or -1 if the value exceeds 10^{18}.

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

We have 101 \times 9901 \times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.

Sample Input 3

31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Wrong Answer

Solution code:
n = int(input())
an = list(map(int, input().split()))
out = an[0]
for a in an[1:]:
  if a == 0:
    out = 0
    break
  out = out * a
  if out > 10 ** 18:
    out = -1
    break
print(out)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
a = map(int,input().split())
#a = sorted(a)
ans = 1
for val in a:
    ans *= val
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
a = map(int,input().split())
ans = 1
for val in a:
    ans *= val
    if ans > 10**18:
        print("-1")
        break
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
mul=1
for i in range(len(a)):
    mul=mul*a[i]
    if mul==0 or mul>1000000000000000000:
      break
if(mul<1000000000000000001):
    print(mul)
else:
    print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline().rstrip('\n')


def calc(N, A):
    result = 1
    for i in range(N):
        result *= A[i]
        if result > 10 ** 18:
            return -1
    return result
    

N = int(input())
A = [int(s) for s in input().split()]
print(calc(N, A))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
tab = list(map(int,input().split()))
res = 1
if 0 in tab:
  print(0)
for a in tab:
  res *= a
  if res > 1000000000000000000:
    print(-1)
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
tab = list(map(int,input().split()))
res = 1
if 0 in tab:
  print(0)
for a in tab:
  res = res*a
  if res > 1000000000000000000:
    print("-1")
print(res)

Submission status: Wrong Answer

Solution code:
from functools import reduce
n = int(input())
tab = list(map(int,input().split()))
if 0 in tab:
  print(0)
res = reduce(lambda x, y: x*y, tab)
if res > 1000000000000000000:
  print("-1")
else:
  print(res)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
s = list(map(int, input().split()))
result = 1
for value in s:
    result *= value
    if result > pow (10,18):
        print(-1)
        sys.exit()
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = list(map(int, input().split()))
result = 1
for value in s:
    result *= value
    if result > pow (10,18):
        print(-1)
        break;
print(result)

Submission status: Wrong Answer

Solution code:
n = int(input());
ans = 1;
zero = False
for i in map(int, input().split()):
    ans *= i
    if i==0:
        zero = True
print(ans if ans>=0 else -1);

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input()
b = input().split()
result = 1
for i in range(int(a)):
    result = result * int(b[i])
    if result > 10**18:
         print(-1)
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    n = input()
    nums = input().split(' ')

    result = 1
    for i in range(int(n)):
        if str(0) in nums:
            result = 0
            break
        result = result * int(nums[i])

    if result >= pow(10, 18):
        result = -1
    print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    n = input()
    nums = input().split(' ')

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

    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
MAX = 10 ** 18
li.sort()
ans = 1
if li[0] == 0:
    ans = 0
else:
    for i in li:
        ans *= i
        if ans >= MAX:
            ans = -1
            break
print(ans)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    n = input()
    nums = input().split(' ')

    result = 1
    for i in range(int(n)):
        result = result * int(nums[i])

    if result >= pow(10, 18):
        result = -1
    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
MAX = 10 ** 18
li.sort()
ans = 1
for i in li:
    ans *= i
    if ans >= MAX or ans == 0:
        ans = -1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_num = [int(_) for _ in input().split(" ")]

product = 1

if 0 in list_num:
    print(0)
else:
    checker = True
    for i, num in enumerate(list_num):
        product *= num
        if len(str(product)) >= 18:
            checker = False
            break
        
    if checker:
        print(product)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_num = [int(_) for _ in input().split(" ")]

product = 1
checker = True
for i, num in enumerate(list_num):
    product *= num
    if len(str(product)) >= 18:
        checker = False
        break
    
if checker:
    print(product)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
c =b. split( )
result = 1
for i in range(int(a)):
    result = result * int(c[i])

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

Submission status: Wrong Answer

Solution code:
n = int(input())
num = list(map(int, input().split()))
limit = 10**18
 
num.sort()
result = num[0]

if result == 0:
    print(0)
else:
    for i in num[1:]:
        result *= i
        if result > limit:
            exit()

    print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
num = list(map(int, input().split()))
limit = 10**18
 
num.sort()
result = num[0]

if num[0] == 0:
    print(0)
else:
    for i in num[1:]:
        result *= i
        if result > limit:
            exit()

    print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [int(s) for s in input().split()]
l = 1
for s in S:
  l = l * s
  if l > 10**18:
    l = -1
    break
print(l)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
for a in A:
  if ans >= 10**(18)//a:
    ans = -1
    break
  else:
    ans *= a

if 0 in A:
  print(0)
else:
  print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in A:
  if ans > 10**(18)/a:
    ans = -1
    break
  else:
    ans *= a

if 0 in A:
  print(0)
else:
  print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in A:
  if ans >= 10**(18)/a:
    ans = -1
    break
  else:
    ans *= a

if 0 in A:
  print(0)
else:
  print(ans)

Submission status: Wrong Answer

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

if 0 in A:
  print(0)

re = 1

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

print(re)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
count = int(input())
num = list(map(int, input().split()))
ans = 1
breakFlag = False
for i in range(len(num)):
  ans = ans*num[i]
  if ans > 1000000000000000000:
    ans = -1
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

Submission status: Wrong Answer

Solution code:
import math
import sys
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
  sys.exit()
for x in i:
  result *= x
#  if(len(str(result)) >= 19):
  if(result >= 10**18):
    print(-1)
    sys.exit()
print(result)

Submission status: Wrong Answer

Solution code:
import math
import sys
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
  sys.exit()
for x in i:
  result *= x
#  if(len(str(result)) >= 19):
  if(result >= 1000000000000000000):
    print(-1)
    sys.exit()
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(np.prod(nums))

Submission status: Wrong Answer

Solution code:
from sys import stdin
from functools import reduce 

# 標準入力から読み込み
inputs = [list(map(int, input().split())) for _ in range(2)]

output = 0 if (0 in inputs) else reduce((lambda x, y: x * y), inputs[1])
output = -1 if (output > 10e18) else output

print(output)

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
a=input()
a0=a.split()
l=list()
b=1
q= "0" in a0
if q==True:
    print(0)
    sys.exit()
for i in range (n):
    a1=int(a0[i])
    b=b*a1
    if b>10**18:
        print(-1)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
nlist = list(map(int, input().split()))
ans = np.prod(np.array(nlist))
if ans > 1000000000000000000:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
  sys.exit()
for x in i:
  result *= x
  if(len(str(result)) >= 19):
    print(-1)
    sys.exit()
print(result)

Submission status: Wrong Answer

Solution code:
import math
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
else:
  for x in i:
    result *= x
  if(len(str(result)) >= 19):
    print(-1)
  else:
    print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=[]
arr=list(map(int,input().split()))
mul=1
b=0
for i in range(n):
  mul*=arr[i]
  if(mul>1000000000000000000):
    b=1
    break
if(b==1):
  print("-1")
else:
  print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
else:
  for i in range(int(N)):
    result *= i
  if(len(str(result)) >= 18):
    print(-1)
  else:
    print(result)

Submission status: Wrong Answer

Solution code:
list = [int(i) for i in input().split()]
answer = 1
if 0 in list:
  answer = 0
else:
  for i in list:
    answer = answer * int(i)

if answer > 1000000000000000000:
  print(-1)
else:
  print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
for r in A:
  ans *= r
  if ans > 1e18:
      print(-1)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
for r in range(N):
  ans *= A[r]
  if ans > 1e18:
      print(-1)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
list = input().split()
answer = 1
if "0" in list:
  answer = 0
else:
  for i in list:
    answer = answer * int(i)

if answer > 1000000000000000000:
  print(-1)
else:
  print(answer)

Submission status: Wrong Answer

Solution code:
list = input().split()
if "0" in list:
  print(0)
else:
  answer = 1
  for i in list:
    answer = answer * int(i)

if answer > 1000000000000000000:
  print(-1)
else:
  print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
print(N)
print(A)
ans = 1
for r in range(N):
  ans *= A[r]
print(ans)

Submission status: Wrong Answer

Solution code:

N=int(input())
input = input()
split = input.split()
data=[]
for i in range(N):
    data.append(int(split[i]))

sum_1=1

for i in data:
    sum_1=sum_1*i

print(sum_1)

Submission status: Wrong Answer

Solution code:
N=int(input())
input = input()
split = input.split()
data=[]
for i in range(N):
    data.append(int(split[i]))

sum_1=1

for i in data:
    sum_1=sum_1*i

print(sum_1)

Submission status: Wrong Answer

Solution code:
def F(A):
  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().strip().split()))
F(A)

Submission status: Wrong Answer

Solution code:
N = int(input())
A_list = [int(e) for e in input().split()]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    n = int(input())
    ans = 1
    for i in map(int, input().split()):
        ans *= i
        if ans > 1e18:
            print(-1)
            exit()
    else:
        print(ans)
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

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

aa = set(A)
ans = 1
for i in range(len(A)):
    if(len(str(ans)) >= 18):
        if(0 not in aa):
            ans = -1
            break
        else:
            ans = 0
    ans *= A[i]

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

Submission status: Wrong Answer

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

aa = set(A)
ans = 1
for i in range(len(A)):
    if(len(str(ans)) >= 18):
        if(0 not in aa):
            ans = -1
            break
        else:
            ans = 0
    ans *= A[i]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
O = pow(10, 18)
N = int(input())
L = list(map(int, input().split()))
M = 1

for i in range(N):
    if L[i - 1] == 0:
        print(0)
        sys.exit()
    else:
        break

for i in range(N):
    M = M * L[i]
    if O < M:
        print(-1)
        sys.exit()
    else:
        continue
print(M)

Submission status: Wrong Answer

Solution code:
import sys
O = pow(10, 18)
N = int(input())
L = list(map(int, input().split()))
M = 1

for i in range(N):
    if L[i - 1] == 0:
        print(0)
        sys.exit()
    else:
        break

for i in range(N - 1):
    M = M * L[i]
    if O < M:
        print(-1)
        sys.exit()
    else:
        continue
print(M)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
input()
l = 10**18
a = 1
for i in map(int, input().split()):
    a *= i
    if a > l:
        a = -1
        break
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input());

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

ok = True;
ans = 1;
for val in a:
    ans *= val;
    if(ans > 1e18):
        ok = False;
        break;

if(ok):
    print(ans);
else:
    print(-1);

Submission status: Wrong Answer

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

v_max = 10 ** 18

result = 1
for v in l:
    # print(v)
    result *= v
    # print(result)
    if result > v_max:
        result = -1
        break
    
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力
list_a.sort(reverse=True)
# list_a = sort(list_a)
result = 1
for i in list_a:
    result = result * i
    if len(str(result-1)) > 19:
        print(-1)
        break

if len(str(result)) <= 19:
    print(result)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力
list_a.sort(reverse=True)
# list_a = sort(list_a)
result = 1
for i in list_a:
    result = result * i
    if len(str(result)) > 18:
        print(-1)
        break

if len(str(result)) <= 18:
    print(result)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力
list_a.sort(reverse=True)
# list_a = sort(list_a)
result = 1
for i in list_a:
    result = result * i
    if len(str(result)) > 18:
        print(-1)
        break

if len(str(result)) <+ 18:
    print(result)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力
result = 1
for i in list_a:
    result = result * i
    if len(str(result)) > 18:
        print(-1)
        break

if len(str(result)) <+ 18:
    print(result)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力

result = functools.reduce(operator.mul, list_a)

if len(str(result)) < 18:
    print(result)
else :
    print(-1)

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力

result = functools.reduce(operator.mul, list_a)

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

Submission status: Wrong Answer

Solution code:
import functools
import operator

n = int(input())
list_a=list(map(int, input().split()))  #リスト入力

for i in list_a:
    result = functools.reduce(operator.mul, list_a)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
list_a=list(map(int, input().split()))  #リスト入力
resu = 1
for i in list_a:
    resu = resu * i

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

Submission status: Wrong Answer

Solution code:
ans=1
n=int(input())
arr=list(map(int,input().split()))
for i in arr:
    if i==0:
        print(0)
    elif ans*i>1000000000000000000:
        print(-1)
    else:
        ans*=i
if (ans<=1000000000000000000 and ans!=0):
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys

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

total = 1
for i in a:
    if int(i) == 0:
        print(0)
        sys.exit()
        
    total = total*int(i)

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

print(total)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

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

Submission status: Wrong Answer

Solution code:
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.count(0)>=0:
        print(0)
        return

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

    print(cal)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.count(0)>=1:
        print(0)
        return

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

    print(cal)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1
    for i in range(N):
        cal*=a[i]
        if cal>=10**18:
            print("-1")
            return

    print(cal)
    return


main()

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
cal=1

for i in range(N):
    cal*=a[i]

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

else :
    print(cal)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
res = arr[0]
print(arr)

for a in arr[1:]:
  res *= a

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int, input().split()))
dijita=1
ha=pow(10,18)
for i in l:
  dijita*=i
  if dijita>ha:
    print(-1)
    break
else:
  print(dijita)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
ans = sum(A)
if ans > 10**18:
  ans == -1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int, input().split()))
cal=1
i=0
new_A=A.sort()
if A[0]==0:
    cal==0
else:
    while i < len(A):
        cal*=A[i]
        i+=1
    if cal>=10**18:
        print(-1)
    else:
        print(cal)

Submission status: Wrong Answer

Solution code:
n = input()
l = list(map(int,input().split()))
x = 1
for h in l:
  x = x* h
  if x>(10**18):
    print(-1)
    break
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input()
s=1
for a in map(int,input().split()):
  if s>0:s*=a
  if s>1e18:s=-1
  if s==0:break
print(s)

Submission status: Wrong Answer

Solution code:
# B - Multiplication 2
def main():
    _, *A = map(int, open(0).read().split())
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= i
        if prod > LIM:
            print(-1)
            return 
    print(prod)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/local/bin/python3
# coding: utf-8
n = input()
hairu = input()
kita = hairu.split(" ")
seki = 1


for c in kita:
    seki = seki * int(c)
    if seki > 10**18:
        break

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

Submission status: Wrong Answer

Solution code:
#!/usr/local/bin/python3
# coding: utf-8
n = input()
hairu = input()
kita = hairu.split(" ")
seki = 1


for c in kita:
    seki = seki * int(c)
    if seki > 10**18:
        break
if seki > 10**18:
    print("-1")
else:
    print(seki)

Submission status: Wrong Answer

Solution code:
#!/usr/local/bin/python3
# coding: utf-8
n = input()
hairu = input()
kita = hairu.split(" ")
seki = 1


for c in kita:
    seki = seki * int(c)
    if seki > 10**18:
        break
    if seki > 10**18:
        print("-1")
    else:
        print(seki)