这里

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int n, s[100005], a[100005], c[2][1000005], ans;
int lb(int x){
return x&-x;
}
void add(int x, int p){
if(p==0) c[x][0]++;
else
for(int i=p; i<=1000000; i+=lb(i))
c[x][i]++;
}
int query(int x, int p){
int re=0;
for(int i=p; i; i-=lb(i))
re += c[x][i];
return re+c[x][0];
}
int main(){
cin>>n;
for(int i=1; i<=n; i++){
scanf("%d", &s[i]);
s[i] += s[i-1];
}
for(int i=0; i<20; i++){
int cnt=0, now=0;
memset(c, 0, sizeof(c));
add(0, 0);
for(int j=1; j<=n; j++){
int tmp=s[j]&(1<<i);
if(tmp) cnt = query(1, 1000000) - query(1, a[j]) + query(0, a[j]);
else cnt = query(0, 1000000) - query(0, a[j]) + query(1, a[j]);
add(tmp>0, a[j]);
if(cnt&1) now ^= 1;
a[j] |= tmp;
}
if(now) ans |= 1<<i;
}
cout<<ans<<endl;
return 0;
}

最新文章

  1. document.getElementById()与 $()区别
  2. mac下使用gcc
  3. 程序猿,千万别说你不了解Docker!
  4. SqlServer性能优化(一)
  5. poj3468(线段树 边覆盖)
  6. JavaEE Tutorials (21) - Java EE安全:高级主题
  7. Jquery中$.ajax()方法参数详解(转)
  8. JVM内存配置详解(转)
  9. Java I/O— 梳理各种“流”
  10. 探索Windows命令行系列(3):命令行脚本基础
  11. DES加密And解密
  12. Linux入门(10)——Ubuntu16.04使用pip3和pip安装numpy,scipy,matplotlib等第三方库
  13. 文件自动备份和同步bypy和syncthing
  14. Redis配置解读
  15. JavaScript Practices
  16. body标签
  17. Spring基于纯注解方式的使用
  18. SpringMVC使用Burlap发布远程服务
  19. 网络基础之IP地址和子网掩码
  20. nginx 添加https 配置

热门文章

  1. B. Dispersed parentheses 记忆化搜索 + 括号序列的状压表示
  2. CentOS 7.x升级内核
  3. Unity里面两种单例模式的实现
  4. [转]Formatting the detail section to display multiple columns (水晶报表 rpt 一页多列)
  5. this的三个要点
  6. 精通AngularJS(三)深入scope,继承结构,事件系统和生命周期
  7. openssl安装介绍
  8. SQL 基本编程
  9. 编写Robotium测试程序
  10. block总结