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

Subarray sum

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of length $n$ consisting of integers. Count the number of contiguous subsequences with a sum equal to $x$. ### Input - The first line contains two integers, $n$ and $x$. - The second line contains $n$ integers $A_i$. ### Output - Print the number of subsequences that satisfy the condition. ### Constraints - $1 \le n \le 10^5$. - $-10^9 \le A_i, x \le 10^9$. ### Example Input: ``` 4 5 1 4 -5 5 ``` Output: ``` 3 ```
Introduction to Prefix sum
Prefix sum
Maximum subarray sum
Balance substring
Divisible by d
Subarray sum
Game on array
2D prefix sum
Stair query
Maximum sum subarray 2
Average
Ratio Substrings
Maximum submatrix sum
Maximum subarray sum 3
Manhattan distance
Minimum distance
Topic
Prefix sum
Rating 800
Solution (1) Solution