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):
import math
A, B = input().split()

print(math.floor(int(A)*float(B)))

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")
        	break
print(ans)

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

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

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

if np.prod(A) >= 10**18:
    print("-1")
else:
    print(np.prod(A))

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)


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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = 1

for i in a:
    ans *= i

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

print(ans)

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
S = 110
for i in range(N):
    S *= A[i]
    if S > 100 ** 9:
        print("-1")
        exit()

print(S)

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

print(S)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
result = 1
for i in A:
    result *= i

s_result = str(result)

if len(s_result) > 18:
    result = "-1"

print(result)

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

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):
#include <bits/stdc++.h>

#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 


#define INT_BITS 32
#define mod 1000000007




#define pb push_back

// #define s second

#define float long double
#define all(c) (c).begin(), (c).end()




int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     uint64_t linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}




#include <bits/stdc++.h>

#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 


#define INT_BITS 32
#define mod 1000000007




#define pb push_back

// #define s second

#define float long double
#define all(c) (c).begin(), (c).end()




int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     uint64_t linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}




#include <bits/stdc++.h>

#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 


#define INT_BITS 32
#define mod 1000000007




#define pb push_back

// #define s second

#define float long double
#define all(c) (c).begin(), (c).end()




int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     int linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}




n = int(input())
arr = list(map(int,input().split()))
res = 1
flag = 1
arr.sort()
inf = int(1e18)
for i in range(n):
  res = res*arr[i]
  if(res > inf):
    flag = 0
    break
 
if(flag == 0):
  print(-1)
else:
  print(res)

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
N = int(input())
A = list(map(lambda a : int(a), input().split(" ")))
ans = 1
print i in range(len(A)):
  ans *= A[i]

print(ans) if ans <= 10 ** 18 else print("-1")

N = int(input())
A = list(map(lambda a : int(a), input().split(" ")))
ans = 1
if A.count(0) > 0:
  ans = 0

for i in range(len(A)):
  ans *= A[i]
  if ans > 10 ** 18:
    ans = -1
    print("-1")
    break
 
if 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):
def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**8
    res = 1
    for num in nums:
        res *= num
    if res > limit:
        return -1
    return res

if __name__ == "__main__":
    print(mul2())

def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**8
    res = 1
    for num in nums:
        res *= num
        if res > limit:
            return -1
    return res

if __name__ == "__main__":
    print(mul2())

n = int(input())
nums = list(map(int,input().split()))
limit = 10**18
res = 1
i = 0
if 0 in num:
    print(0)
    exit()
while i<n:
    res *= nums[i]
    i += 1
    if res > limit:
        res = -1
        break
print(res)

def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**18
    res = 1
    i = 0
    while i<n:
        res *= nums[i]
        i += 1
        if res >= limit:
            res = -1
            break
    return res

if __name__ == "__main__":
    print(mul2())

def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**8
    res = 1
    for num in nums:
        res *= num
        if res > limit:
            return -1
    return res

if __name__ == "__main__":
    print(mul2())

def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**8
    res = 1
    for num in nums:
        res *= num
        if res > limit:
            return -1
    return res

if __name__ == "__main__":
    print(mul2())

n = int(input())
nums = list(map(int,input().split()))
limit = 10**18
res = 1
i = 0
if 0 in nums:
    print(0)
    exit()
while i<n:
    res *= nums[i]
    i += 1
    if res > limit:
        res = -1
        break
print(res)

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


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

ans = reduce(operator.mul, a)

print(ans) if ans < 10**18 else print(-1)





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

    if 0 in a :
        print(0)
        return

    ans = 1
    for x in a:
        ans *= x
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


calc()


Verdicts: Wrong Answer

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

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

ans = 1
for i in range(n):
    ans = ans * a[i]
    
if ans <= 1e18:
    print(ans)  
else:
    print(-1)


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(ans)
    
else:
    print(-1)


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(ans)  
else:
    print(-1)


n = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0]==0:
    print(0)
    exit()

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

print(ans)



Verdicts: Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
from sys import stdin
input = stdin.readline
def main():
  n = int(input())
  a = list(map(int,input().split())).sort()
  if a[0] == 0:
    print(0)
    return
  ret = 1
  for i in a:
    ret *= i
    if ret > 10**18:
      print(-1)
      return
  print(ret)
main()

from sys import stdin
input = stdin.readline
def main():
  n = int(input())
  a = list(map(int,input().split()))
  a.sort()
  if a[0] == 0:
    print(0)
    return
  ret = 1
  for i in a:
    ret *= i
    if ret > 10**18:
      print(-1)
      return
  print(ret)
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())

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

if l[0] == 0:
  print(0)
  exit()
res = 1

for i in l:
  res *= i
  if res > 10 **18:
    print(res)
    exit()
  print(res)

n = int(input())

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

if l[0] == 0:
  print(0)
  exit()
res = 1

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
flag = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    flag = 1
    break
if flag == 0:
    print(sum)

n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    exit()
print(sum)

n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper:
    flag = 0
  elif num == 0
    sum = 0
if flag == 1:
  print(sum)
elif:
  print(-1)

n = int(input())
sum = 1
for (int i = 0; i < n; i++):
  sum = sum * int(input())
  
if (sum > 1000000000000000000):
  print("-1")
else:
  print(sum)

n = int(input())
sum = 1
flag = 1
limit = 1000000000000000000
nums = list(map(int, input().split()))
for num in nums:
  if num == 0:
    sum = 0
    break;
  if flag == 1:
    sum *= num
  if sum > limit or sum == -1:
    flag = 2
    sum = -1
print(sum)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

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

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

result = 1
m = 0
while result <= 10**18:
  result *= alist[m]
  m += 1

if m < n or result > 10**18:
  print("-1")
else:
  print(result)

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

if 0 in alist:
  print("0")
else:
  result = 1
  m = 0
  while result <= 10**18:
    result *= alist[m]
    m += 1
  if m < n or result > 10**18:
    print("-1")
  else:
    print(result)

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

if 0 in alist:
  print("0")
else:
  result = 1
  m = 0
  while result <= 10**18 and m < n:
    result *= alist[m]
    m += 1
  if m < n or result > 10**18:
    print("-1")
  else:
    print(result)

Verdicts: Runtime Error

Runtime Error

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

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

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

print(ans)
  

N = int(input())
A = list(map(int, input().split()))
if min(A) == 0:
  ans = 0
  print(ans)
  quit()

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

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

print(m)

from decimal import Decimal
a,b=map(float, input().split())
print(int(Decimal(a)*Decimal(b)))

A,B=map(float, input().split())
A=int(A*100)
B=int(B*100)
print(int(A*B)/10000)

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

print(m)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

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

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
inlist = list(map(int, input().split()))
x = 1
if N == len(inlist):    
    for A in inlist:
        x = x*A
    if x >= 10**18:
        print(-1)
    else:
        print(x)

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

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

N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print (0)
    
prod = 1
for a in A:
    prod *= a

if prod>1000000000000000000:
    print (-1)
elif prod<1000000000000000000:
    print(prod)


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

import math
N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    
    prod = math.prod(A)
    if prod>1000000000000000000:
        print(-1)
    else:
        print(prod)


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

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)

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

N = int(input())
if N>2 and N<100000:
    A = list(map(int,input().split()))
    if 0 in A:
            print (0)
    
    prod = 1
    for a in A:
        prod *= a

    if prod>1000000000000000000:
        print (-1)
    elif prod<1000000000000000000:
        print(prod)


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


N = int(input())
L = input().split()
 
 
def mult():
    if "0" in L:
        return 0
    else:
        a = 1
        for i in L:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
        return a
 
print(mult())

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

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

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



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


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



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



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




A = list(map(int,input().split()))
N = len(A)
c = 1
for i in N:
  c *= A[i]
  print(c)
if c >= 10**18:
  print("-1")

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


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



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


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


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




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



n=int(input())
ls=[int(s) for s in input().split(" ")]

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

  print(num)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
import sys

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

if 0 in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= x
        if cur > 10 ** 18:
            print(-1)
            sys.exit()
        print(cur)


import sys

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

if 0 in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= a
        if cur > 10 ** 18:
            print(-1)
            sys.exit()
        print(cur)


import sys

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

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


import sys

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

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

cur = 1
for a in a_list:
  cur *= a
  if cur > 10 ** 18:
    print(-1)
    sys.exit()

print(cur)
  

Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

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

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

n=int(input())
x=sorted(map(int,input().split()))
ans=x[0]
lot=1
while ans<10**18 and lot<n:
    ans=ans*x[lot]
    lot+=1
print(-1 if ans>=10**18 else ans)

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
n=input()
list1=map(int,input().split())
if 0 in list1:
    print(0)
else:
    ans=1
    for i in list1:
        ans*=i
        if ans>1e18:
            ans=-1
            break
    print(ans)

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

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

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

import numpy
n = int(input())
A = map(int, input().split())
ans = numpy.prod(A)
if ans > 10 ** 8:
  print(-1)
else:
  print(ans)

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

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


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

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

limit = pow(10, 18)

ans = 1.0
for e in nums:
    ans *= e

if ans >= limit:
    ans = -1

print(int(ans))


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

limit = pow(10, 18)

ans = 1

if 0 in nums:
    ans = 0
else:
    for e in nums:
        if ans > limit / e:
            ans = -1
            break
        else:
            ans *= e

if ans > limit:
    ans = -1

print(int(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(""))
mul = 1
while N >0 :
    a = int(input(""))
    mul = mul * a
    N -= 1





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


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

for a in A:
  ans*=a

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

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

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

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

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

  if 0 in A:
    print(0)
    return

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

  print(p)
main()

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

  if 0 in A:
    print(0)
    return

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

  print(p)
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):
res = 1
if 0 in a:
    res = 0
else:
    for i in range(n):
        b = a.pop()
        if b != 1:
            res *= b

            if res > 1000000000000000000:
                res = -1
                break
print(res)

n = int(input())
a = list(map(int, input().split()))
res = 1
a.sort()
for i in a:
    res *= i
    if res > 1000000000000000000:
        res = -1
        break
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()) 
print (type(N),N) 
#<class 'int'> 20



huga = list(map(int, input().split()))
print(type(huga),huga)
# <class 'list'> [12, 34]
print(type(huga[0]),huga[0])
# <class 'int'> 12

ans = 1

for int i in huga:
    ans = ans * i

print(ans)


N = int(input()) 



huga = list(map(int, input().split()))
if 0 in huga:
    print(0)
else:
    ans = 1
    flg = 0
    for number in huga:
        ans = ans * number
        if ans > 10**18:
            flg = 1
            break
    if flg == 0:
        print(ans)
    else:
        print('-1')


Verdicts: Runtime Error

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

Submission attempts (in order):
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 sol():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    prod=1 
    for i in a:
        prod*=i 
        if prod>1000000000000000000:
            print(-1)
            return
    print(prod)
    
sol()

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

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

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

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

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

for i in S:
  if ans >= 0:
    ans = ans * i
  if ans > 10**18:
    ans = -1
    
if 0 in S:
  ans = 0
  
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):
import numpy as np
import functools
import operator

def calc(n):
    return n / 1000000

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




count = np.prod(A)

#print(count)

count = count * 1000000 ** len(A)

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


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

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

count = 1
for i in A:
    count *= i
    if 10 ** 18 < count:
        break

if 10 ** 18 < count:
    count = -1

print(count)


Verdicts: Runtime Error

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

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

product = 1

if 0 in a:
    product = 0
else:
    for i in a:
        product *= i
        if product >= 10**18:
            product = -1
            break

print(product)


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

product = 1
for i in a:
    if i==0:
        product = 0
        break
    product *= i
    if product >= 10**18:
        product = -1
        break

print(product)


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

product = 1

if 0 in a:
    product = 0
else:
    for i in a:
        product *= i
        if product > 10**18:
            product = -1
            break

print(product)


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

for i in a:
  t *= a[i]

print(str(t))

n = int(input())
a = map(int,input().split())
a.sort()
t = 1
 
for i in range(len(a)):
  t *= a[i]
  if t > 10**18:
    break

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

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

for i in a:
  t *= i

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

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

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):
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    
if res < 10 ** 18:    
    print(res)
else:
    print(-1)
    

# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break

if 0 in s:
    print(0)
elif res <= 10 ** 18:    
    print(res)
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

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

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

answer = an[0]
check = 10**18
for i in range(1,len(an)) :
  answer *= an[i]
  if answer >= check:
    print(-1)
    sys.exit()

print(answer)


import sys

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

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

answer = 1
check = 10**18
for i in range(len(an)) :
  answer *= an[i]
  if answer > check:
    print(-1)
    sys.exit()

print(answer)


Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
ans=1
i=0
while ans<=1000000000000000000:
    ans=ans*A[i]
    i+=1

if A.count(0)>0:
    print(0)
else:
    print(ans if ans<=1000000000000000000 else "-1")

N = int(input())
A = list(map(int, input().split()))
ans=1
i=0
while ans<=1000000000000000000 and i<N:
    ans=ans*A[i]
    i+=1

if A.count(0)>0:
    print(0)
else:
    print(ans if ans<=1000000000000000000 else "-1")

Verdicts: Runtime Error

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

Submission attempts (in order):
n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in A:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
print(ans)

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

n = int(input());
ls = list(map(int,input().split()))
ans = 1;
for i in ls:
	ans=i*ans;
if(ans<10**18):
	print(ans);
else:
	print(-1)
	

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

for i in ls:
	ans=i*ans;
	if(1000000000000000000>ans):
		ans=-1;
		break;
print(ans)
	

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

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

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

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

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

print(s)


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

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

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




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

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


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

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


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

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


Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
def main ():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print (0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
        return
    print(prod)

main ()


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

U = 10 ** 18
p = 1
for x in A:
    p *= x
    if p > U:
        p = U + 1

if p > U:
    print(-1)
else:
    print(p)


from operator import mul
from functools import reduce
N, *A = map(int, open(0).read().split())

while len(A) > 1:
  n = len(A)
  if n & 1:
    A.append(1)
    n += 1
  L, R = A[:n//2], A[n//2:]
  A = [x * y for x, y in zip(L, R)]
x = A[0]
if x > 10 ** 18:
  x = -1
print(x)


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

if 0 in a:
    print(0)
    exit

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

input()
a = list(map(int,input().split()))
ans = 1
for n in a:
    ans *= n
    if ans <= 10**18:
        print(ans)
    break:
print(-1)

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

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

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

Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
package main

import (
	"fmt"
)

func main() {
	var n int
	var ans int = 1
	var t int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		ans = ans * t
		if ans > 1000000000000000000 {
			ans = -1
		}
	}

	fmt.Println(ans)
}


package main

import "fmt"

func main() {
	var n int
	var ans int = 1
	fmt.Scan(&n)
	t := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t[i])
	}

	for i := 0; i < n; i++ {
		ans = ans * t[i]
	}

	if ans > 1000000000000000000 {
		ans = -1
	}
	fmt.Println(ans)
}


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

ans = 1

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

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

    if ans > 10**18:
        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):
A = int(input())
B = float(input())
print(A * round(B,2))

import math
N = int(input())
list=[]
for i in range(N):
    i = int(input())
    list.append(i)

if  math.prod(list) < 1000000000000000000:
    print(math.prod(list))
else:
    print(-1)

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

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):
#B
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
        

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

import numpy as np
n = int(input())
a = list(map(int,input().split()))
a_n = np.array(a,dtype=np.float64)
#print(a_n)
result = np.prod(a_n)
if result >= 10**18:
    print(-1)
else:
    print(int(result))

#B
from functools import reduce
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
a.sort()
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
    break
        
if flg:
    print(result)
else:
    print(-1)

import numpy as np
n = int(input())
a = list(map(int,input().split()))
a_n = np.array(a,dtype=np.float64)
#print(a_n)
result = np.prod(a_n)
if result > 10**18:
    print(-1)
else:
    print(result)

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

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):
n=input()
sum=1
f=0
f2=0
for i in range(0,n):
	a=input()
	if  (a==0): 
		f2=1
	sum=sum*a
	if (sum>1000000000000000000):
		f=1;
}
if (f2==1): 
	print("0\n")
else if(f==1):
	print("-1\n")
else:
	print(sum)
	print("\n")

n=int(input())
sum=1
f=0
f2=0
for i in range(1,n):
	a=(input())
	if  (a==0): 
		f2=1
	sum=sum*a
	if (sum>10**18):
		sum=-1
                break
}
if f2==1: 
	print(0)
else:
	print(sum)

n=(input())
		a=0
		sum=1
		f=0
		f2=0
		for i in range(1,n):
			a=(input())
			if(a==0): 
				f2=1
			sum*=a
			if (sum>1000000000000000000):
				f=1;
		}
		if(f2==1): 
			print("0\n")
		else if(f==1):
			print("-1\n")
		else:
			print(sum)
			print("\n")

n=ll(input())
		a=0
		sum=1
		f=0
		f2=0
		for i in range(1,n):
			a=ll(input())
			if(a==0): 
				f2=1
			sum*=a
			if (sum>1000000000000000000):
				f=1;
		}
		if(f2==1): 
			print("0\n")
		else if(f==1):
			print("-1\n")
		else:
			print(sum)
			print("\n")

n=int(input())
sum=1
f=0
f2=0
for i in range(0,n):
	a=int(input())
	if  (a==0): 
		f2=1
	sum=sum*a
	if (sum>1000000000000000000):
		f=1;
}
if (f2==1): 
	print("0\n")
else if(f==1):
	print("-1\n")
else:
	print(sum)
	print("\n")

n=input()
sum=1
f=0
f2=0
for i in range(0,n):
	a=input()
	if  (a==0): 
		f2=1
	sum*=a
	if (sum>1000000000000000000):
		f=1;
}
if (f2==1): 
	print("0\n")
else if(f==1):
	print("-1\n")
else:
	print(sum)
	print("\n")

n=input()
sum=1
f=0
f2=0
for i in range(1,n):
	a=input()
	if (a==0): 
		f2=1
	sum*=a
	if (sum>1000000000000000000):
		f=1;
}
if(f2==1): 
	print("0\n")
else if(f==1):
	print("-1\n")
else:
	print(sum)
	print("\n")

n=int(input())
A=list(map(int,input().split()))
sum=1
f=0
f2=0
if 0 in a:
        f2=1
for a in A:
	sum=sum*a
	if (sum>10**18):
		sum=-1
                break
if f2==1: 
	print(0)
else:
	print(sum)

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
p = 10**18
a.sort()
#print(a)
if 0 in a:
    print(0)
    exit()

a.reverse()
#print(a)
ans = 1
for i in a:
    ans *= i
    #print(ans)
    if ans > p:
        print(-1)
        exit()
    else:
        print(ans)

n = int(input())
a = list(map(int, input().split()))
p = 10**18
a.sort()
#print(a)
if 0 in a:
    print(0)
    exit()

a.reverse()
#print(a)
ans = 1
for i in a:
    ans *= i
    #print(ans)
    if ans > p:
        print(-1)
        exit()

print(ans)



Verdicts: Wrong Answer

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

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

a.sort()

if a[0] == 0:
        print(0)
        exit(0)

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

print(ans)


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

a.sort()

if a[0] == 0:
        print(0)
        exit(0)

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

print(ans)


Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
num = sorted(list(map(int, input().split())), reverse=True)
# print(num)
prod = 1
if num[-1] == 0:
  prod = 0
for i in range(N):
  if prod > 10^18:
    prod = -1
    break
  else:
    prod *= num[i]
print(prod)

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

N = int(input())
num = list(map(int, input().split()))
prod = 1
for i in range(N):
  prod *= num[i]
print(prod if prod <= 10^18 else -1)

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted