Partition Hard !
Practice
4 (1 votes)
Easy
Problem
14% Success 83 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Jeetesh normally loves solving arrays . However, when his friend Asnani gave him a problem on arrays, he found it difficult to solve and feels bad .Now it is your turn to help Jeetesh regain his interest by helping him . The problem is as follows :

Given an array of size N , find the number of ways to parition the array such that the product of numbers in each partition is negative .

Since the answer can be large output it modulo 1000000007.

INPUT :

The first line of input contains an integer N , denoting the size of the array.

The second line of input contains N integers ,denoting  the elements of the array.

OUTPUT :

A single integer denoting the required answer.

CONSTRAINTS :

\(1 \leq N \leq 10^5\)

\(-10^4 \leq array \ element \leq 10^4\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
Tags:
Easy
Points:20
12 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsMathDynamic Programming
Points:20
Tags:
Dynamic Programming
Editorial

No editorial available for this problem.