report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Large subarray - MarisaOJ: Marisa Online Judge

Large subarray

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ positive integers. Calculate the number of subarray with sum larger or equal to $k$. ### Input - The first line contains 2 integer $n, k$. - The second line contains $n$ space-separated integers $A_i$. ### Output - Print an integer, the number of subarray with sum larger or equal to $k$. ### Constraints - $1 \le n \le 10^{5}$. - $1 \le A_i, k \le 10^9$. ### Example Input: ``` 5 6 1 2 1 4 5 ``` Output: ``` 6 ```
Introduction to Binary Search
Binary search
Binary search 2
Binary search 3
Large subarray
Count query
Counting pairs
The k-th candy
Triangle edges
Hamming number
Consecutive integers
Gnimmah distance
Subarray
Topic
Binary search
Rating 800
Solution (1) Solution