#P4135. 作诗
作诗
Description
Due to time pressure, after finishing a poem SHY still needs to crush OI, so she takes an article of length , reads it times, and each time reads only a contiguous segment . From this segment, she selects some Chinese characters to form a poem. Because SHY likes parallelism, she requires that every selected character must appear a positive even number of times within . Also, SHY wants the number of distinct selected characters (two identical characters are considered the same type) to be as large as possible. So SHY asks LYD to arrange the selection.
LYD, being a "sha×", certainly cannot do it, so he asks you for help.
Problem summary: Given positive integers not greater than and queries, each query asks how many numbers in appear a positive even number of times.
Input Format
This problem is strictly online.
The first line contains three integers , , and , representing the article length, the number of character types, and the number of selections.
The second line contains integers. The -th integer is the code of the -th character.
Each of the next lines contains two integers and . Let the previous query’s answer be (for the first query, ). Define , , and if , swap and . Then the current query is .
Output Format
Output lines. The -th integer is the maximum number of distinct characters SHY can select for the -th query.
5 3 5
1 2 2 3 1
0 4
1 2
2 2
2 3
3 5
2
0
0
0
1
Hint
Constraints
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号