MAXOR - MAXOR
题意翻译
### 题目大意
给出一个序列 $a_1,a_2,...a_n$ 。
对于一个询问的区间 $(l,r)$ ,需要求出 $\max(a_i \oplus a_{i+1} \oplus a_{i+2} \oplus ... \oplus a_j)$ 其中 $l \le i \le j \le r$ 。(这里的 $\oplus$ 代表异或)。
现在给出若干个 $(x,y)$ ,则定义查询区间 $(l,r)$ 为
$l=\min((x+lastans) \mod n+1,(y+lastans) \mod n+1 )$
$r=\max((x+lastans) \mod n+1,(y+lastans) \mod n+1 )$
其中 $lastans$ 表示上一次查询的答案。而对于第一次查询, $lastans$ 为 $0$ 。
### 输入格式
第一行,两个数 $n,m$ 。表示有 $n$ 个数和 $m$ 个查询。
第二行有 $n$ 个数,表示序列。
第三行开始有 $m$ 行,每行两个数表示 $(x,y)$ 。
### 输出格式
$m$ 行。一行一个数表示查询的最大值。
### 数据范围
- $n\le1.2\times10^4$。
- $0\le a_i<2^{31}$。
- $m\le 6\times10^3$。
题目描述
You are given a sequence A\[1\], A\[2\], ..., A\[N\]. (0
A query is defined as follows:
- Query(x,y) = Max { a\[i\] xor a\[i+1\] xor ... xor a\[j\] ; l
- l = min ( ((x+lastans) mod N)+1 , ((y+lastans) mod N)+1 ).
- r = max ( ((x+lastans) mod N)+1 , ((y+lastans) mod N)+1 ).
- lastans\[1\] = 0 , lastans\[i\] = Query\[i-1\].
Given M queries, your program must output the results of these queries. (0
**IMPORTANT : PROBLEM ENHANCED. ( I'M SO SORRY.. )**
输入输出格式
输入格式
- The first line of the input file contains 2 numbers : N M.
- In the second line, N numbers follow.
- M lines follow, where line i contains 2 numbers xi and yi.
输出格式
Your program should output the results of the M queries, one query per line.
输入输出样例
输入样例 #1
3 3
1 4 3
0 1
0 1
4 3
输出样例 #1
5
7
7