Partitions
Practice
3.9 (13 votes)
Algorithms
Binary search
Medium
Searching
Partitions
Problem
24% Success 2993 Attempts 30 Points 5s Time Limit 256MB Memory 1024 KB Max Code
You are given an array $$a$$ of size $$n$$ and two integers $$l$$ and $$r$$. You have to find the number of partitions of array $$a$$ such that the sum of elements in each partition lies between $$l$$ and $$r$$(both inclusive). Since the answer can be large, find the answer modulo $$10^9+7$$ ($$1000000007$$).
Input Format
First line contains \(3\) space separated denoting the values of $$n$$, $$l$$ and $$r$$ ($$ 1 \le n \le 10^5 $$, $$ 1 \le l \le r \le 10^{12} $$).
Next line contains $$n$$ space separated integers denoting the values of array $$a$$ ($$ 1 \le a[i] \le r$$).
Output Format
Print the answer in a single line.
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
AlgorithmsBinary SearchMediumSearchingSortinghiring
Points:30
10 votes
Tags:
Binary SearchAlgorithmsC++
Points:30
5 votes
Tags:
Binary SearchGreedy AlgorithmsMediumOpenSearching
Editorial
Login to unlock the editorial