#P7279. 光棱碎片
光棱碎片
Description
The boy only has one string , with length , indexed from ;
and an array .
The boy wrote down two numbers and tried to find those shards that have been lit by light:
For two substrings in that occur at different positions but are identical in content, if $L \le (a_{r_1} \oplus a_{r_2}) + (r_1 - l_1 + 1) \le R$, then there is light between these two substrings.
Here, denotes the substring formed by concatenating the characters of with indices in in order, and denotes the bitwise XOR operation.
The boy wants to know how many pairs of substrings have light between them.
Substring pairs are unordered. Specifically, and are considered the same pair.
You only need to output the answer modulo .
Input Format
The first line contains a positive integer .
The second line contains a string .
The third line contains non-negative integers .
The fourth line contains two non-negative integers .
Output Format
One line containing a non-negative integer, which is the answer.
5
abcbc
0 1 2 3 4
2 7
2
Hint
Constraints:
For of the testdata, ;
For of the testdata, ;
For of the testdata, , , , and contains only lowercase letters.
"A gift from the problem setter"
Be a bit braver. Trust the constant factor of some algorithm. What you think of might be a trash standard solution.
Translated by ChatGPT 5
京公网安备 11011102002149号