hdu 5683 zxa and xor 暴力
zxa and xor
Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
zxa thought only doing this was too boring, hence a function funct(x,y) defined by him, in which ax would be changed into y irrevocably and then compute ⊗1≤i<j≤n(ai+aj) as return value.
zxa is interested to know, assuming that he called such function m times for this sequence, then what is the return value for each calling, can you help him?
tips:⊗1≤i<j≤n(ai+aj) means that (a1+a2)⊗(a1+a3)⊗⋯⊗(a1+an)⊗(a2+a3)⊗(a2+a4)⊗⋯⊗(a2+an)⊗⋯⊗(an−1+an).
For each test case:
The first line contains two positive integers n and m.
The second line contains n non-negative integers, represent a1,a2,⋯,an.
The next m lines, the i-th line contains two non-negative integers x and y, represent the i-th called function is funct(x,y).
There is a blank between each integer with no other extra space in one line.
1≤T≤1000,2≤n≤2⋅104,1≤m≤2⋅104,0≤ai,y≤109,1≤x≤n,1≤∑n,∑m≤105
3 3
1 2 3
1 4
2 5
3 6
6
8
After the first called function, this sequence is $\{4,2,3\}$, and $(4+2)\otimes(4+3)\otimes(2+3)=4$.
After the second called function, this sequence is $\{4,5,3\}$ and $(4+5)\otimes(4+3)\otimes(5+3)=6$.
After the third called function, this sequence is $\{4,5,6\}$ and $(4+5)\otimes(4+6)\otimes(5+6)=8$.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000009
#define inf 999999999
#define esp 0.00000000001
//#pragma comment(linker, "/STACK:102400000,102400000")
int scan()
{
int res = , ch ;
while( !( ( ch = getchar() ) >= '' && ch <= '' ) )
{
if( ch == EOF ) return << ;
}
res = ch - '' ;
while( ( ch = getchar() ) >= '' && ch <= '' )
res = res * + ( ch - '' ) ;
return res ;
}
int a[];
int main()
{
int x,y,z,i,t;
scanf("%d",&x);
while(x--)
{
scanf("%d%d",&y,&z);
for(i=;i<=y;i++)
scanf("%d",&a[i]);
int sum=;
for(i=;i<=y;i++)
for(t=i+;t<=y;t++)
sum^=(a[i]+a[t]);
while(z--)
{
int pos,change;
scanf("%d%d",&pos,&change);
for(i=;i<=y;i++)
{
if(i!=pos)
sum^=(a[i]+change)^(a[i]+a[pos]);
}
printf("%d\n",sum);
a[pos]=change;
}
}
return ;
}
hdu 5683 zxa and xor 暴力的更多相关文章
- HDU 5683 zxa and xor 暴力模拟
zxa and xor 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5683 Description zxa had a great interes ...
- hdu-5683 zxa and xor (位运算)
题目链接: zxa and xor Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
- UVA.12716 GCD XOR (暴力枚举 数论GCD)
UVA.12716 GCD XOR (暴力枚举 数论GCD) 题意分析 题意比较简单,求[1,n]范围内的整数队a,b(a<=b)的个数,使得 gcd(a,b) = a XOR b. 前置技能 ...
- HDU 2920 分块底数优化 暴力
其实和昨天写的那道水题是一样的,注意爆LL $1<=n,k<=1e9$,$\sum\limits_{i=1}^{n}(k \mod i) = nk - \sum\limits_{i=1}^ ...
- hdu 4712 Hamming Distance(随机函数暴力)
http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Other ...
- hdu 5277 YJC counts stars 暴力
YJC counts stars Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- HDU 5762 Teacher Bo (暴力)
Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
- hdu 4876 ZCC loves cards(暴力)
题目链接:hdu 4876 ZCC loves cards 题目大意:给出n,k,l,表示有n张牌,每张牌有值.选取当中k张排列成圈,然后在该圈上进行游戏,每次选取m(1≤m≤k)张连续的牌,取牌上值 ...
- HDU 5442 Favorite Donut(暴力 or 后缀数组 or 最大表示法)
http://acm.hdu.edu.cn/showproblem.php?pid=5442 题意:给出一串字符串,它是循环的,现在要选定一个起点,使得该字符串字典序最大(顺时针和逆时针均可),如果有 ...
随机推荐
- iOS CoreMotion 纪录步数
- (void)startUpdateAccelerometer{ /* 设置采样的频率,单位是秒 */ NSTimeInterval updateInterval = 0.05; // ...
- c# Winform间的页面传值
Form2 public partial class Form2 : Form { public string str; public Form2() { InitializeComponent(); ...
- windows下resin的配置部署与调试
配置 从Resin官网(http://www.caucho.com)下载Resin解压后,启动Resin,运行resin根目录下的resin.exe文件,运行期间将出现下图所示的命令提示符窗口. 表示 ...
- OneThink视图模型进行组合查询!文档组合文档详情
测试方法:twoCate: public function twoCate(){ $where = array( 'category_id'=>43 ); $list = D('TwoView' ...
- 树链剖分+离散+扫描(HDU5044)
Tree Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Subm ...
- VMware Fusion 5虚拟机怎样与MAC共享文件
刚刚在Macbook Pro中安装了VMware Fusion 5虚拟机,虚拟机里装了Windows7,在虚拟机的设置里也设置了共享MAC的几个文件夹,以便与MAC交换文件,但是在Windows7里怎 ...
- ASM学习记录
代理: 代理模式: 静态代理: 动态代理:是指在运行期动态的为指定的类生成其代理类.(需要相关的运行时编译技术) Javassist:Javassist是一个运行时编译库,他能动态的生成或修改类的字节 ...
- SQL---->数据库表设计思想
数据,一对多: 多的表中加外健约束 数据,多对多: 创建中间表,中间表中有关系对应的外健约束 数据一对一: 主从关系,从表中加外健约束,加唯一约束,加非空约束!!!!! 一张表中-自连接:(理论可以, ...
- Oracle管理监控之测试环境清理用户脚本
--PL/SQL块删除用户 declare cursor cur_duser is select sid, serial# from v$session where username in ( ...
- Tfs 2015 代理池配置笔记
Tfs的构建代理池其实是在代理服务器上开启一个TFSBuild的代理服务,配好相关的Tfs地址后,就能在Tfs管理界面看到了. 如果是Tfs服务和发布代理是同一台服务器,具体操作详见: 安装TFS20 ...