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

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

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

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

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

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

    
main()


Verdicts: Wrong Answer

Wrong Answer

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

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

for i in A:
    T = 1*i
    if T > 10^18:
        print(-1)
    else:
        print(T)


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

for i in A:
    T = 1
    T = T *i
    if T > 10^18:
        print(-1)
    else:
        print(T)


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

T = 1
for i in A:
    T = T * i
    if T > 10**18:
        print("-1")
    else:
        print(T)

x, y = map(int, input().split())
for y in range(x):
  C = 1*Y
  if C >= 10^18:
    print(-1)
  else:
    print(C)


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

T = 1
for i in A:
    T = T * i
    if T > 10 ^ 18:
        print(-1)
    else:
        print(T)

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

i = 1
total = all(i*list)
if total > 10**18:
    print(-1)
else:
    print(total)

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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):
import operator
from functools import reduce

n = int(input())

a = [int(x) for x in input().split() if x != "1"]

print(a)
sum = reduce(operator.mul, a, 1)



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



n = int(input())

a = [int(x) for x in input().split() ]
sum = a[0]

if 0 in a:
        sum = 0
else:
    for i in range(1,len(a)):
        sum = sum * a[i]
        if sum > 10**18:
            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):
def quick_sort(list):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i>stand):
            over.append(i)
        elif(i<stand):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort(over)
    else:
        pass
    if(len(under)>1):
        under=quick_sort(under)
    else:
        pass

    return under+same+over

N=int(input())
A=list(map(int,input().split()))
A=quick_sort(A)
print(A)
ans=1
way=0
for i in A:
    ans*=i
    way=str(ans-1)
    if(len(way)>=19):
        ans=-1
        break
    else:
        pass
print(ans)

def quick_sort(list):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i>stand):
            over.append(i)
        elif(i<stand):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort(over)
    else:
        pass
    if(len(under)>1):
        under=quick_sort(under)
    else:
        pass

    return under+same+over

N=int(input())
A=list(map(int,input().split()))
A=quick_sort(A)
ans=1
way=0
for i in A:
    ans*=i
    way=str(ans-1)
    if(len(way)>=19):
        ans=-1
        break
    else:
        pass
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()))
if 0 in a:
    print(0)
else:
    s=1
    for i in a:
    s=s*i
    if s>10**18:
        s=-1
        break
    print(s)

n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    s=1
    for i in a:
        s=s*i
        if s>10**18:
            s=-1
            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 = sorted(list(map(int, input().split())))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
#  print(a, mul)
  if a == 0:
    print(0)
    break
  if mul >= (10 ** 18):
    print(-1)
    break
else:
  print(mul)

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

N = int(input())
A = reversed(sorted(map(int, input().split())))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
  if mul >= 10 ** 18:
    print(-1)
    break
else:
  print(mul)

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

N = int(input())

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

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

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

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

import numpy as np

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

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

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

Verdicts: Wrong Answer

Wrong Answer

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

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

ans = 1

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

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

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

ans = 1

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

for i in a:
    ans = ans * i
    if ans > 1e18:
        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):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int maxn = 2e5 + 10;
ll a[maxn];
int pos(ll x)
{
    int num = 0;
    while (x)
    {
        num++;
        x /= 10;
    }
    return num;
}
int main()
{
    int n, f = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    ll sum = a[1];
    for (int i = 2; i <= n; i++)
    {
        int x = pos(sum);
        int y = pos(a[i]);
        if (x + y >= 21)
        {
            f = 1;
            break;
        }
        else
            sum *= a[i];
        if(sum>1000000000000000000)
            break;
    }
    if ((sum > 1000000000000000000) || f == 1)
        cout << -1 << endl;
    else
        cout << sum << endl;
}

n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  n--
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)

n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  if sum>Max:
    break
  n-=1
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)


n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)


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):
inputs = input().split(" ")
decimal = int(float(inputs[1])*100)
product = int(inputs[0])*(decimal)
print(product//100)

count = int(input())
nums = input().split(" ")

product = 1

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

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

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

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

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

print(ans)

N = map(int,input().split())
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 = map(int,input().split())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
  ans *= a
  #print(ans)
  if ans > 10**18:
    ans = -1
    break
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())
a = [int(x) for x in input().split()]
def check():
  ans = 1
  for i in range(n):
    ans *= a[i]
    if ans > 10**8:
      return -1
  return ans

print(check)

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

def check():
  ans = 1
  for i in range(n):
    ans *= a[i]
  return ans
p = check()
#print(p)
if p < 10 ** 18:
  print(p)
else:
  print(-1)

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

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

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 numba import njit
N = int(input())
a = list(map(int, input().split()))
@njit()
def main():
  b = 1
  for i in range(N):
    b *= a[i]
    if 0 in a:
      b = 0
      break
    elif b > 10 ** 18:
      b = 'out'
      break
  if b == 'out':
    print(-1)
  else:
    print(b)
main()

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

if b == 'out':
  print(-1)
else:
  print(b)


Verdicts: Runtime Error

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

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

ans = 1

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

print(ans)

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

ans = 1

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

if 0 in A:
    ans = 0
else:
    for num in A:
        ans *= num
        if ans > 1e18:
            ans = -1
            break

print(ans)

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

if 0 in A:
    ans = 0
else:
    for num in A:
        ans *= num
        if ans > 1e18:
            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 = input()
li = list(map(int, input().split()))
a = 1
for x in li:
    a *= x
if a > 10**18:
    print(-1)
elif n > 10**5:
    print(-1)
else:
    print(a)

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

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
import numpy as np
n = int(input())
arr=list(map(int,input().split()))
p = np.prod(arr)
if(len(str(p)) > 18):
  print("-1")
  exit(0)
else:
  print(p)

import numpy as np
n = int(input())
p = np.prod(list(map(int,input().split())))
if(len(str(p)) > 18):
  print("-1")
  exit(0)
else:
  print(p)

def main()
	n = int(input())
  	arr = list(map(input().split()))
    if 0 in arr:
        print(0)
        return
    prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ == "__main__":
    main()

import numpy as np
n = int(input())
arr = []
arr = map(int, input().split())
p = np.prod(arr)
if(len(str(p)) > 19):
  print("-1")
  exit(0)
else:
  print(c)

def main()
	n = input()
  	arr = list(map(input().split()))
    if 0 in arr:
        print(0)
        return
  	prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ = "__main__":
	main()

def main()
	n = input()
  	arr = list(map(input().split()))
    if 0 in arr:
        return print(0)
  	prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            return print(-1)
    print(prod)

if __name__ = "__main__":
	main()

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

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

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

N = int(input())
A = list(map(int, input().split()))
for i in A:
    B = B * A[i]
    if B >= 1000000000000000000
        return print(-1)
print(B)

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

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

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

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


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


Verdicts: Runtime Error

Runtime Error

Runtime Error

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

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

ans=1
if b[-1]==0:
    print(0) 
else:
    for i in a:
        ans=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):
n = int(raw_input())
lst = list(map(int, raw_input().strip().split()))[:n]
mx = 1000000000000000000
if 0 in lst:
    print(0)
else:
    cur = lst[0]
    for x in lst[1:]:
        cur = cur * x
        if cur > mx:
            cur = -1
            break
    print(cur)


n = int(input())
lst = list(map(int, input().strip().split()))[:n]
mx = 1000000000000000000
if 0 in lst:
    print(0)
else:
    cur = lst[0]
    for x in lst[1:]:
        cur = cur * x
        if cur > mx:
            cur = -1
            break
    print(cur)


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

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

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print(0)
  exit()
for a in t[1:]:
	to *= a
    if to > 10**18:
	print("-1")
    exit()
else:
  print(to)

n = int(input())
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print(0)
  exit()
for a in t[1:]:
    to *= a
    if to > (10**18):
        print("-1")
        exit()
print(to)

Verdicts: Runtime Error

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

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

import sys
N=int(input())
if N>10**5 or N<2:
    sys.exit(1)
s=1
for i in range(N):
    a=input().rstrip()
    s*=int(a)
if s<10e+18:
    print(s)
else:
    print("-1")

import sys
N=int(input())
if N>10**5 or N<2:
    sys.exit()
a=input().split(' ')
if N<len(a):
    sys.exit()
s=1
for i in range(N):
    s*=int(a[i])
if s<10**18:
    print(s)
else:
    print("-1")

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

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

    for i in a:
        if s<10**18:
            s*=i
    if s>10**18:
        print(-1)
        sys.exit()
    print(s)

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

cnt = 1

if a in 0:
    print(-1)
else:
    for i in range(n):
        cnt = cnt * a[i]

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

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

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

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

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

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

if 0 in A:
  print(0)
else:
  prod = 1
  for i in A:
    prod *= i
    if prod>10**18:
      print(-1)
      F = False
      break
  if F:
  	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):
from itertools import accumulate
from operator import add, mul
import sys 
input = sys.stdin.readline


n = int(input())

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


b = accumulate(a, mul)

c = list(b)


# b=1

#     b *= a[i]
    
if c[n-1]-1 > 10**18:
    print('-1')
else:
    # print(b)
    print(c[n-1]-1)


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


Verdicts: Wrong Answer

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

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

list1 = [ a for items in list1 list1[items]=input() ]



# a= int(input())
# list1 =[]

n = int(input())
a = list(map(int,input().split()))
# print(a)
# a.sort(reverse=True)
# print(a)
if 0 in a :
    ans  = 0
    print(ans)
else :
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > 10**18 :
            print(-1)
            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=list(map(int,input().split()))
w=pow(10,18)
p=1
a.sort()
if a[0]==0:
  print(0)
else:
  for k in range(n):
    p*=a[k]
    if p>w:
      break
  print(p) if p<w else print(-1)

n=int(input())
a=list(map(int,input().split()))
w=pow(10,18)
p=1
for k in range(n):
  p*=a[k]
print(p) if p<w else print(-1)

n=int(input())
a=list(map(int,input().split()))
w=pow(10,18)
p=1
a.sort()
if a[0]==0:
  print(0)
else:
  for k in range(n):
    p*=a[k]
    if p>w:
      print(-1)
      break
  if p<=w:
    print(p)

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



N=int(input())
s=input().split()
result=1
if '0' in s:
  print(0)
else:
  for i in range (N):
    result=result*int(s[i])
    if result>= 10**18:
      print(-1)
      break
    elif i==N-1 and result<=10**18:
      print(result)



N=int(input())
s=input().split()
result=1
if 0 in s:
  print(0)
else:
  for i in range (N):
    result=result*int(s[i])
    if result>= 10**18:
      print(-1)
      break
    elif i==N-1 and result<=10**18:
      print(result)
      

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

N=int(input())
s=input().split()
result=1
for i in range (N):
  result=result*int(s[i])
  if result>= 10**18:
    print(-1)
    break
  elif i==N-1 and result<=10**18:
    print(result)

A, B=input().split()
b=float(B)*100
result=int(A)*int(b)
answer=round(result/100,2)
print(int(answer))

N=int(input())
s=input().split()
result=1
if '0' in s:
  print(0)
else:
  for i in range (N):
    result=result*int(s[i])
    if result> 10**18:
      print(-1)
      break
    elif i==N-1 and result<=10**18:
      print(result)



Verdicts: 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):
def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A = sort(A)
  if A[0] == 0:
    print(0)
    return

  X = 1
  for i in A:
    X *= A
    if X > 10 ** 18:
      print("-1")
      return

  print(X)

demon()

def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  if A[0] == 0:
    print(0)
    return

  X = 1
  for i in A:
    X *= i
    if X > 10 ** 18:
      print("-1")
      return

  print(X)

demon()

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
input = sys.stdin.readline
N = int(input())
x = sorted(list(map(int, input().split())))
print(x)
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)


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: 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,*a=map(int,open(0).read().split())
a.sort()
ans=1
for i in a:
    ans*=i
    if ans>=1e18:
        print(-1)
        exit()
print(ans)

n,*a=map(int,open(0).read().split())
a.sort()
ans=1
for i in a:
    ans*=i
    if ans>1e18:
        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):
p=int(input())
k=list(map(int,input().split()))
t=1
for e in k:
    t = t*e
    if t>10**8:
        break
if t>10**8:
    print(-1)
else:
    print(t)

p=int(input())
k=list(map(int,input().split()))

t=1
for e in k:
    t = t*e

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

p=int(input())
k=list(map(int,input().split()))
if 0 in k:
    print(0)
else:
    t=k[0]
    for e in range(1,len(k)):
        t = t * k[e]
        if t > 10**8:
          break
    if t > 10**8:
        print(-1)
    else:
        print(t)

p=int(input())
k=list(map(int,input().split()))
if 0 in k:
    print(0)
else:
    t=k[0]
    for e in range(1,len(k)):
        t = t * k[e]
        if t > 10**18:
          break
    if t > 10**8:
        print(-1)
    else:
        print(t)

p=int(input())
k=list(map(int,input().split()))
if 0 in k:
    print(0)
else:
    t=k[0]
    for e in range(1,len(k)):
        t = t * k[e]
    
    if t > 10**8:
        print(-1)
    else:
        print(t)

p=int(input())
k=list(map(int,input().split()))

t=k[0]
for e in range(1,len(k)):
    t = t * k[e]

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

p=int(input())
k=list(map(int,input().split()))
if 0 in k:
    print(0)
else:
    t=k[0]
    for e in range(1,len(k)):
        t = t * k[e]
        if t > 10**18:
          break
    if t > 10**18:
        print(-1)
    else:
        print(t)

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

from sys import stdin
N = stdin.readline().rstrip()
An = [int(x) for x in stdin.readline().rstrip().split()]
W = 1
if any([A == 0 for A in An]):
    print(0)
    exit()
for A in An:
    W = W * A
    if 1000000000000000000 < W:
        print(-1)
        exit()
print(W)

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
flg = False
for i in map(int,input().split()):
	a *= i
	if a>10e12:
		flg = True
		break

if flg:
	print(-1)
else:
	print(a)

from math import floor
 
a,b = list(map(float,input().split()))
print(floor(a*b))

n=int(input())
a = 1
for i in map(int,input().split()):
	a *= i

if a>10e12:
	print(-1)
else:
	print(a)

import sys

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

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

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)

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()); s= 1
lis = list(map(int,input().split()))
if 0 in lis: print(0)
else:
    for i in range(n):
        s = s*lis[i]
    s = str(s)
    if len(s)>18: print(-1)
    else: print(s)

n = int(input()); s= 1
lis = list(map(int,input().split()))
for i in range(n):
    s = s*lis[i]
s = str(s)
if len(s)>18: print(-1)
else: print(s)

input()
lis = list(map(int,input().split()))
s = 1
if 0 in lis: print(0)
else:
    for i in range(len(lis)):
        s = s * lis[i]
        if s>1000000000000000000: print(-1); exit()
    print(s)

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

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

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

Verdicts: Runtime Error

Runtime Error

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

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

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

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

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

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

digits=0
ans=1

for i in list:
  digits+=len(i)
  if digits >=18:
   print(-1)
  else:
    ans=ans*i

print(ans)

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

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

n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
  if i==0:
    print(0)
    exit()

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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):
N=int(input())
A=[map(int,input().split())]
sorted(A)
if A[0] == 0:
  print(0)
  exit(0)

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

N=int(input())
A=list(map(int, input().split()))
A=sorted(A,reverse=True)
if A[N-1] == 0:
  print(0)
  exit(0)

ans = 1
for i in range(N):
  ans*=A[i]
  if(ans>1000000000000000000):
    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):
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  
  if 0 in A:
    print(0)
    return
  
  prod = 1
  
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
    print(prod)
              
main ()


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


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

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)

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 product > 10**18:
            checker = False
            break
        
    if checker:
        print(product)
    else:
        print(-1)

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 = input().split()
result = 1
line = pow(10,18)

for i in range(N):
  result *= int(A[i])
  if result >= line:
    result = -1
    break

print(result)

N = int(input())
A = input().split()
result = 1
line = pow(10,18)

for i in range(N):
  result *= int(A[i])
if result >= line:
  result = -1

print(result)

N = int(input())
A = input().split()
result = 1
line = pow(10,18)

if "0" in A:
  result = 0
else:
  for i in range(N):
    result *= int(A[i])
    if result > line:
      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())
arr = [int(x) for x in input().split()]
n = 1
flag = True
for i in range(n):
  n *= arr[i]
  if n > 10**18:
    flag = False
    break
if flag:
  print(n)
else:
  print(-1)

t = int(input())
arr = [int(x) for x in input().split()]
n = 1
flag = True
if 0 in arr:
    print(0)
else:
    for i in range(t):
        n *= arr[i]
        if n > 10**18:
            flag = False
            break
    if flag:
        print(n)
    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):
import sys

num_data = sys.stdin.readlines()
num_list = num_data[1].split()
ans = 1
for i in range(int(num_data[0])):
  ans *= int(num_list[i])

if ans >= pow(10, 18):
  print("-1")
else:
  print(ans)

import sys

num_data = sys.stdin.readlines()
num_list = num_data[1].split()
ans = 1
flag = True
for i in range(int(num_data[0])):
  ans *= int(num_list[i])
  if ans >= pow(10, 18):
    flag = False
    break
if flag:
  print(ans)
else:
  print("-1")

import sys
import numpy as np

num_data = sys.stdin.readlines()
str_num_list = num_data[1].split()
num_list = [int(s) for s in str_num_list]
ans = 1
if 0 in num_list:
  ans = 0
else:
  for i in range(int(num_data[0])):
    ans *= num_list[i]
    if ans > pow(10, 18):
      ans = -1
      break

print(ans)

Verdicts: Wrong Answer

Wrong Answer

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

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

N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    output = 1
    output *= a[i]

    if output> 10**18:
        print(-1)
        quit()
print(output)


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

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

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

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

a = int(input())

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

a = 1

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

import numpy as np

a = int(input())

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

lp = np.prod(list)

print(lp if lp > 1000000000000000000 else "-1")

import numpy as np

a = int(input())

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

lp = np.prod(list)

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

num = int(input())

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

a = 1

for i in list:
  a = a * i
  if a > 10**18:
    a = -1
    break
  
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())
As = [int(num) for num in input().split()]
flag = False
res = 1

As_sorted = sorted(As, reverse=True)
if As_sorted[-1] == 0:
    print(0)
else:
    for num in As_sorted:
        res *= num
        if res > 10^18:
            flag = True
            break            
    if flag:
        print(-1)
        print(res)
    else:
        print(res)

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

As_sorted = sorted(As, reverse=True)
if As_sorted[-1] == 0:
    print(0)
else:
    flag = False
    res = 1
    for num in As_sorted:
        res *= num
        if res > 10**18:
            flag = True
            break            
    if flag:
        print(-1)
    else:
        print(res)

Verdicts: Wrong Answer

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
A = [int(i) for i in input().split()]
ans = reduce(mul, A)
print(ans if ans <= 10**18 else -1)

N = int(input())
A = sorted([int(i) for i in 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)

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()))
total = 1
for i in a:
    total *= i
    
if len(str(total)) >18:
    print(-1)
else:
    print(total)

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

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

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

Verdicts: Wrong Answer

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

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

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

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result > 10 ** 18:
            result = -1
            break
        else:
            result *= i
print(result)

N = int(input())
mylist = list(map(int , input().split(" ")))
result = 1

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result * i > 10 ** 18:
            result = -1
            break
        else:
            result *= i
            
print(result)

Verdicts: Runtime Error

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

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

if 0 in a:
	print(0)
	exit(0)
 
for i in a :
  print(prod)
  if  i * prod > 1e18:
    print(-1)
    exit(0)
  else:
    prod = prod *  i
 
print(prod)

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

for i in a :
  if  i * prod > 1e18:
    print(-1)
    exit(0)
  else:
    prod *= i

print(prod)

'''input
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

'''

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

if 0 in a:
	print(0)
	exit(0)
 
for i in a :
  # print(prod)
  if  i * prod > 1e18:
    print(-1)
    exit(0)
  else:
    prod = prod *  i
 
print(prod)







































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


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

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

ans = 1
for num in A
	ans*=num
print(num)


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

print(ans)

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

print(ans)

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

Verdicts: Wrong Answer

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

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

#import 
#=input()
n=int(input())
#=map(int,input().split())
a=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

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

Verdicts: Wrong Answer

Accepted