Long Binary Sequence
Time limit2sMemory limit512 MB
Count the distinct consecutive substrings of a binary string of length up to 1e9, where the 1s are given at m up to 1000 positions.
- Level
Hard9 of 10
- Topics
- String matching, String, Implementation
- Solved
- No attempts yet
Problem
Bobo has a very long binary sequence of length . All positions are except for positions , and .
Find the number of distinct consecutive substrings of .
Input
The first line contains two integers and (, ).
The second line contains integers ().
Output
Print a single integer, the number of distinct consecutive substrings of .