#3822. CF1000F One Occurrence-标准mo
CF1000F One Occurrence-标准mo
题目描述
You are given an array consisting of integers, and queries to it. -th query is denoted by two integers and . For each query, you have to find any integer that occurs exactly once in the subarray of from index to index (a subarray is a contiguous subsegment of an array). For example, if , then for query the subarray we are interested in is , and possible answers are , and ; for query the subarray we are interested in is , and there is no such element that occurs exactly once.
Can you answer all of the queries?
输入格式
The first line contains one integer ( ).
The second line contains integers ( ).
The third line contains one integer ( ).
Then lines follow, -th line containing two integers and representing -th query ( ).
输出格式
Answer the queries as follows:
If there is no integer such that it occurs in the subarray from index to index exactly once, print . Otherwise print any such integer.
输入输出样例 #1
输入 #1
6
1 1 2 3 2 4
2
2 6
1 2
输出 #1
4
0