#P5398. [Ynoi2018] GOSICK
[Ynoi2018] GOSICK
Description
Victo rica gives you a sequence . Each query gives an interval .
Count the number of ordered pairs such that and is a multiple of .
Input Format
The first line contains two integers .
The second line contains integers, representing the sequence .
Then follow lines, each containing two integers , representing one query.
Output Format
For each query, output one line with one integer, representing the answer.
6 3
1 1 4 5 1 4
1 1
4 5
1 4
1
3
10
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477.
Constraints: for of the data, , .
Translated by ChatGPT 5
京公网安备 11011102002149号