#P9990. [Ynoi Easy Round 2023] TEST_90
[Ynoi Easy Round 2023] TEST_90
Problem Description
You are given a sequence of length .
There are queries. In each query, given , find how many subintervals in the interval satisfy , and the number of distinct values that have appeared in is odd.
Input Format
The first line contains an integer .
The next line contains integers representing the sequence .
The next line contains an integer .
The next lines each contain two integers , representing a query.
Output Format
For each query, output one line containing one integer, which is the answer.
5
2 3 5 1 5
5
2 3
1 1
1 3
2 5
2 4
2
1
4
6
4
10
2 8 5 1 10 5 9 9 3 5
10
6 8
1 2
3 5
5 7
1 7
3 9
4 9
1 4
3 7
2 5
4
2
4
4
16
16
12
6
9
6
Hint
Idea: nzhtl1477, Solution: ccz181078, Code: ccz181078, Data: ccz181078.
For of the testdata, .
For of the testdata, .
For the other of the testdata, the number of distinct values that appear in the sequence does not exceed .
For of the testdata, , , .
For each query, .
All values above are integers.
Translated by ChatGPT 5