#P5070. [Ynoi Easy Round 2015] 即便看不到未来
[Ynoi Easy Round 2015] 即便看不到未来
Description
Ke Duoli gives you a sequence. For each query, you need to count, in a given interval, the number of maximal consecutive value-range segments of lengths .
A consecutive value-range segment is defined as follows:
- Sort all numbers in the interval and remove duplicates. Let the resulting sequence be .
- For a pair , if every number in is equal to the previous number .
- And for the pairs and , neither satisfies the condition above, then we call a maximal consecutive value-range segment, with length .
Input Format
The first line contains two integers , representing the length of the sequence and the number of queries.
The next line contains integers representing the sequence.
Then follow lines, each containing two integers , representing the query interval.
Output Format
For each query, output a string of length . The -th character represents the number of maximal consecutive segments of length modulo .
8 9
2 3 3 3 3 6 6 6
1 8
2 3
4 5
6 8
1 2
3 4
5 6
3 8
5 5
1100000000
1000000000
1000000000
1000000000
0100000000
1000000000
2000000000
2000000000
1000000000
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: mcfx, Data: nzhtl1477.
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号