2017icpc 西安 XOR
XOR
Consider an array AAA with n elements . Each of its element is A[i]A[i]A[i] (1≤i≤n)(1 \le i \le n)(1≤i≤n) . Then gives two integers QQQ, KKK, and QQQ queries follow . Each query , give you LLL, RRR, you can get ZZZ by the following rules.
To get ZZZ , at first you need to choose some elements from A[L]A[L]A[L] to A[R]A[R]A[R] ,we call them A[i1],A[i2]…A[it]A[i_1],A[i_2]…A[i_t]A[i1],A[i2]…A[it] , Then you can get number Z=KZ = KZ=K or (A[i1]A[i_1]A[i1] xor A[i2]A[i_2]A[i2] … xor A[it]A[i_t]A[it]) .
Please calculate the maximum ZZZ for each query .
Input
Several test cases .
First line an integer TTT (1≤T≤10)(1 \le T \le 10)(1≤T≤10) . Indicates the number of test cases.Then TTT test cases follows . Each test case begins with three integer NNN, QQQ, KKK (1≤N≤10000, 1≤Q≤100000, 0≤K≤100000)(1 \le N \le 10000,\ 1 \le Q \le 100000 , \ 0 \le K \le 100000)(1≤N≤10000, 1≤Q≤100000, 0≤K≤100000) . The next line has NNN integers indicate A[1]A[1]A[1] to A[N]A[N]A[N] (0≤A[i]≤108)(0 \le A[i] \le 10^8)(0≤A[i]≤108). Then QQQ lines , each line two integer LLL, RRR (1≤L≤R≤N)(1 \le L \le R \le N)(1≤L≤R≤N) .
Output
For each query , print the answer in a single line.
样例输入
1
5 3 0
1 2 3 4 5
1 3
2 4
3 5
样例输出
3
7
7
分析:线段树维护区间线性基;
或一个数可以预处理的时候直接把有1的那些位屏蔽掉;
现场做不出来,果然还是因为太菜了呢。。
2017icpc 西安 XOR的更多相关文章
- 计蒜客 A1607 UVALive 8512 [ACM-ICPC 2017 Asia Xi'an]XOR
ICPC官网题面假的,要下载PDF,点了提交还找不到结果在哪看(我没找到),用VJ交还直接return 0;也能AC 计蒜客题面 这个好 Time limit 3000 ms OS Linux 题目来 ...
- CodeForces 1100F Ivan and Burgers
CodeForces题面 Time limit 3000 ms Memory limit 262144 kB Source Codeforces Round #532 (Div. 2) Tags da ...
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 xor (根号分治)
xor There is a tree with nn nodes. For each node, there is an integer value a_iai, (1 \le a_i \le ...
- 2017 ICPC网络赛(西安)--- Xor
题目连接 Problem There is a tree with n nodes. For each node, there is an integer value ai, (1≤ai≤1,000 ...
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 G. Xor
There is a tree with nn nodes. For each node, there is an integer value a_iai, (1 \le a_i \le 1,0 ...
- 2017 ICPC西安区域赛 A - XOR (线段树并线性基)
链接:https://nanti.jisuanke.com/t/A1607 题面: Consider an array AA with n elements . Each of its eleme ...
- 【分块】计蒜客17120 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 G. Xor
题意:给一棵树,每个点有权值.q次询问a,b,k,问你从a点到b点,每次跳距离k,权值的异或和? 预处理每个点往其根节点的路径上隔1~sqrt(n)的距离的异或和,然后把询问拆成a->lca(a ...
- ACM-ICPC 2017 西安赛区现场赛 A. XOR(线性基+线段树)
题目链接:https://nanti.jisuanke.com/t/20749 参考题解:https://blog.csdn.net/Lee_w_j__/article/details/8266418 ...
- 【2017西安邀请赛:A】XOR(线段树+线性基)
前言:虽然已经有很多题解了,但是还是想按自己的理解写一篇. 思路:首先分析题目 一.区间操作 —— 线段树 二.异或操作 —— 线性基 这个两个不难想,关键是下一步的技巧 “或”运算 就是两个数的二进 ...
随机推荐
- 456 132 Pattern 132模式
给定一个整数序列:a1, a2, ..., an,一个132模式的子序列 ai, aj, ak 被定义为:当 i < j < k 时,ai < ak < aj.设计一个算法,当 ...
- 桥接模式和php实现
桥接模式(Bridge Pattern): 将抽象部分与它的实现部分分离,使它们都可以独立地变化.它是一种对象结构型模式,又称为柄体(Handle and Body)模式或接口(Interface)模 ...
- Red Hat Linux常用命令
1.查看机器型号 [root@local ~]# dmidecode | grep "Product Name" Product Name: VMware Virtual Plat ...
- .net mvc 运行监控和错误捕捉
方法类 /// <summary> /// 运行监控类 /// </summary> [AttributeUsage(AttributeTargets.Class | Attr ...
- 3D旋转矩阵的推导过程
3D旋转矩阵的推导过程 包含平移的线性变换称作仿射变换,3D中的仿射变换不能用 3 x 3 矩阵表达,必须使用4 x 4矩阵. 一般来说,变换物体相当于以相反的量变换描述这个物体的坐标系.当有多个变换 ...
- Regular Expression Flavors
Perl https://perldoc.perl.org/perlre.html PCRE http://www.pcre.org/current/doc/html/pcre2syntax.html ...
- codeforces_D. Social Circles
http://codeforces.com/contest/1060/problem/D 题意: n个客人,每个客人希望自己左边空li个座位,右边空ri个座位,可以形成任意个圆,问最少多少个座位. 思 ...
- Swift Intermediate Language (SIL)
Swift Intermediate Language (SIL) https://github.com/apple/swift/blob/master/docs/SIL.rst#witness-me ...
- STL:set的使用
关于set set是以特定的顺序存储相异元素的容器. set是关联式容器,C++ STL中标准关联容器set, multiset, map, multimap内部采用的就是一种非常高效的平衡检索二叉树 ...
- C#中练级orcle数据查询
直接贴代码哈哈哈, public DataTable getInfo(int flag) { OracleConnection conn = null; DataSet ds = new DataSe ...