Kayzin has a list of integers, initially the list is a_1,a_2,\ldots,a_na1​,a2​,…,an​. He will execute qq operations.

For an operation of first type, he will select an interval [l_i, r_i][li​,ri​], copy and insert it to the end of the interval.

For an operation of second type, he wonder the x_ixi​-th integer of the list.

You need to print the xor sum of all the answers of second type operations.

ps: What is xor? The xor value of two integers is equal to addition in binary without carry.

ps: nn is a constant for each test case.

Input

First line is an integer TT, indicating the number of test cases. For each test case:

First line is 2 integers n,qn,q, indicating the length of initial list and the number of operations.

Next line is nn integers a_1,a_2,\ldots,a_na1​,a2​,…,an​, indicating the initial list.

Next qq line, one operation per line. The ii-th line could be 3 integers (1,l_i,r_i1,li​,ri​), indicating the first type operation, or 2 integers (2,x_i2,xi​), indicating the second type operation.

1\le T \le 10,1≤T≤10, 1\le n,q\le 10^5,1≤n,q≤105, 1\le a_i\le 10^9,1≤ai​≤109, \sum n \le 10^5,∑n≤105, \sum q \le 10^5,∑q≤105, 1\le x_i,l_i,r_i \le n,1≤xi​,li​,ri​≤n, the sum of the number of first type operations (all test cases together) not exceeds 2000020000.

Output

For each test case, print one line, indicating the xor sum of the answers.

题意:有一个长度为n的数组,然后有两个操作,操作1 l r是将lr这段数复制之后加在r后,操作2 x是找位于x的数的所有异或和

思路:将lr这段复制加在r后面相当于加了长度为(r-l+1)的数让r后面的数往后了,所以变化后的r后面的数是原来数组里的数往后推了(l-r+1)个,那么我们找变化后的r后面的数ai实际上就是他前面的第r-l+1个数,即变化后的数组里的a[i]=变化前的数里的a[i-(r-l+1)],然后我们可以从后往前遍历数组让r+1~n的数ai全是a[i-(r-l+1)],就完成了每次的复制。

/*.----------------.  .----------------.  .----------------.  .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. |
| |  ________    | || |  _________   | || | ____    ____ | || |     ____     | |
| | |_   ___ `.  | || | |_   ___  |  | || ||_   \  /   _|| || |   .'    `.   | |
| |   | |   `. \ | || |   | |_  \_|  | || |  |   \/   |  | || |  /  .--.  \  | |
| |   | |    | | | || |   |  _|  _   | || |  | |\  /| |  | || |  | |    | |  | |
| |  _| |___.' / | || |  _| |___/ |  | || | _| |_\/_| |_ | || |  \  `--'  /  | |
| | |________.'  | || | |_________|  | || ||_____||_____|| || |   `.____.'   | |
| |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' |'----------------'  '----------------'  '----------------'  '----------------'*/
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<unordered_map>
#include<unordered_set>
#include<stack>
#define int long long
#define lowbit(x) x&(-x)
#define PI 3.1415926535
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int gcd(int a,int b){return b>0 ? gcd(b,a%b):a;
}
const int N=1e5+10;
int n,q;
int a[N];
/*
int dx[8]={-2,-2,-1,1,2,2,-1,1};
int dy[8]={-1,1,2,2,1,-1,-2,-2};
int dx[4]={0,-1,0,1};
int dy[4]={-1,0,1,0};
int dx[8]={-1,1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
*/
void sove(){cin>>n>>q;for(int i=1;i<=n;i++){cin>>a[i];}int con=0;while(q--){int op;cin>>op;if(op==1){int l,r;cin>>l>>r;for(int i=n;i>=r+1;i--){a[i]=a[i-(r-l+1)];}}else{int x;cin>>x;con^=a[x];}}cout<<con<<endl;
}signed main(){ios::sync_with_stdio(false);cin.tie() ,cout.tie() ;int t=1;cin>>t;while(t--){sove();}return 0;
}

C - Copy (hdu)相关推荐

  1. Trie树的常见应用大总结(面试+附代码实现)

    (一)Trie的简介 Trie树,又称字典树,单词查找树或者前缀树,是一种用于快速检索的多叉树结构,如英文字母的字典树是一个26叉树,数字的字典树是一个10叉树.他的核心思想是空间换时间,空间消耗大但 ...

  2. hdu 4605 Magic Ball Game (在线主席树/离线树状数组)

    版权声明:本文为博主原创文章,未经博主允许不得转载. hdu 4605 题意: 有一颗树,根节点为1,每一个节点要么有两个子节点,要么没有,每个节点都有一个权值wi .然后,有一个球,附带值x . 球 ...

  3. HDU 1153 magic bitstrings(读题+)

    hdu 1153 magic bitstrings 题目大意 一个质数p,现在让你求一个p-1长度的"01魔法串".关于这个魔法串是这么定义的:      我们现在把这个串经过一段 ...

  4. 【转载】图论 500题——主要为hdu/poj/zoj

    转自--http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...

  5. hdu 4333 Revolving Digits

    http://acm.hdu.edu.cn/showproblem.php?pid=4333 对我来说这个题 太难了  看着标准程序敲的  伤不起呀 解析说是和KMP有关 不过已经变形的不成样子了 如 ...

  6. 教你小小JAVA爬虫爬到HDU首页(只为学习)

    记得以前刷hdu的时候总是发现有人能一分钟内提交很多次 而且还ac  感觉不可思议.后来百度搜了搜 原来是网络爬虫 带着这一届acm成员集训的时候有成员说hdu炸了  一直判断中  我就说是爬虫... ...

  7. 下面属于python内置对象的有哪些_python练习题-写一个函数,打印所有包含copy方法的内置对象...

    代码: #encoding=utf-8 for i in dir(__builtins__): #print "i:",i try: #这里的i是个字符串,并不能直接用dir(i) ...

  8. Docker 入门系列(7)- Dockerfile 使用(FROM、RUN、CMD、EXPOSE、ENV、ADD、COPY、ENTRYPOINT、VOLUME、WORKDIR)

    Dockerfile 是一个文本格式的配置文件,用户可以使用 Dockerfile 来快速创建自定义的镜像. 1. 基本结构 Dockerfile 由一行行命令语句组成,并且支持以 # 开头的注释行. ...

  9. torch中的copy()和clone()

    torch中的copy()和clone() 1.torch中的copy()和clone() y = torch.Tensor(2,2):copy(x) --- 1 修改y并不改变原来的x y = x: ...

  10. Go 学习笔记(11)— 切片定义、切片初始化、数组和切片差异、字符串和切片转换、len()、cap()、空 nil 切片、append()、copy() 函数、删除切片元素

    1. 切片定义 Go 语言切片是对数组的抽象. Go 中提供了一种灵活,功能强悍的内置类型切片("动态数组"),与数组相比切片的长度是不固定的,可以追加元素,在追加时可能使切片的容 ...

最新文章

  1. Java 定时任务调度工具 Quartz(Part 2)
  2. linux 卸载 rtx,Ubuntu20.04系统卸载软件及清理系统垃圾缓存以及新力得
  3. apollo 配置中心_分布式配置中心之Apollo
  4. dockerfile拉取私库镜像_还在用Alpine作为你Docker的Python开发基础镜像?其实Ubuntu更好一点...
  5. linux db2 权限管理,DB2五种管理权限
  6. 可以分屏的软件_Screen分屏软件下载|Screen+专业分屏 免费版v1.4.25 下载
  7. Linux---基础指令
  8. [转载] numpy.dot numpy.linalg.eig numpy.linalg.svd np.linalg.inv 用法 + 例子
  9. WidsMob Viewer Pro Mac如何批量调整照片大小及格式
  10. ASP.NET 3.5核心编程学习笔记(44):HTTP处理程序的编写之从数据库加载图像
  11. u-boot 2016.05 添加自己的board 以及config.h uboot移植
  12. 【图文详解:索引极简教程】SQL 查询性能优化原理
  13. android实现登录页面视频播放背景
  14. 分析服务用多维度、多场景的用户分层,带您深度玩转精细化游戏运营
  15. 2015中国国内元器件分销商10亿俱乐部20强榜单
  16. 三七互娱秋招web前端笔试题编程题(使用原生JS实现一个英雄类Hero, 可以按照以下方式调用正确输出)
  17. java 过滤script_Java过滤任意(script,html,style)标签符,返回纯文本--封装类
  18. alter在MySQL中是什么意思_MySql中要AlterTable的同学请注意!!!_MySQL
  19. 胖大海和罗汉果可以同泡吗
  20. 基于微信小程序的西餐外卖系统的设计与实现NodeJS-计算机毕业设计

热门文章

  1. python已知三角形的顶点坐标,求任一顶点角度
  2. 8.线性回归之非线性回归
  3. CSS中animation动画-详解
  4. 基于频域的数字图像水印算法设计
  5. 服装尺寸 html,国家标准服装尺寸表
  6. oracle pdb与cdb区别,CDB与PDB的系统关系
  7. 为Visual Studio创建项目模板(VSIX / C#/ 2019)
  8. DUXCMS 2.x学习问题(一)
  9. ip地址与交换机工作原理
  10. 石墨烯海水淡化lammps模拟建模方法