Codeforces Round #539 (Div. 2) C. Sasha and a Bit of Relax(前缀异或和)
转载自:https://blog.csdn.net/Charles_Zaqdt/article/details/87522917
题目链接:https://codeforces.com/contest/1113/problem/C
#include<cstdio>
#include<map>
using namespace std; typedef long long LL;
typedef pair<int, int> P;
map<P, int>ma; int main()
{
int n;
scanf("%d", &n);
ma[P(, )] = ; //补充一个(0,0)
int pre = ; //异或前缀和
LL ans = ;
for (int i = ; i <= n; i++)
{
int tmp;
scanf("%d", &tmp);
pre ^= tmp;
ans += ma[P(pre, i % )]++;
}
printf("%I64d\n", ans);
return ;
}
Codeforces Round #539 (Div. 2) C. Sasha and a Bit of Relax(前缀异或和)的更多相关文章
- Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax(思维题)
Problem Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax Time Limit: 2000 mSec Problem ...
- Codeforces Round #539 (Div. 2) C Sasha and a Bit of Relax
题中意思显而易见,即求满足al⊕al+1⊕…⊕amid=amid+1⊕amid+2⊕…⊕ar且l到r的区间长为偶数的这样的数对(l,r)的个数. 若al⊕al+1⊕…⊕amid=amid+1⊕amid ...
- Codeforces Round #539 (Div. 2) - D. Sasha and One More Name(思维)
Problem Codeforces Round #539 (Div. 2) - D. Sasha and One More Name Time Limit: 1000 mSec Problem ...
- Codeforces Round #539 (Div. 1) C. Sasha and a Patient Friend 动态开点线段树
题解看这里 liouzhou_101的博客园 更简洁的代码看这里: #include <bits/stdc++.h> using namespace std; typedef long l ...
- Codeforces Round #539 (Div. 1) E - Sasha and a Very Easy Test 线段树
如果mod是质数就好做了,但是做除法的时候对于合数mod可能没有逆元.所以就只有存一下mod的每个质因数(最多9个)的幂,和剩下一坨与mod互质的一部分.然后就能做了.有点恶心. CODE #incl ...
- Codeforces Round #539 (Div. 1) 1109F. Sasha and Algorithm of Silence's Sounds LCT+线段树 (two pointers)
题解请看 Felix-Lee的CSDN博客 写的很好,不过最后不用判断最小值是不是1,因为[i,i]只有一个点,一定满足条件,最小值一定是1. CODE 写完就A,刺激. #include <b ...
- Codeforces Round #539 (Div. 2)
Codeforces Round #539 (Div. 2) A - Sasha and His Trip #include<bits/stdc++.h> #include<iost ...
- Codeforces Round #539 (Div. 2) 题解
Codeforces Round #539 (Div. 2) 题目链接:https://codeforces.com/contest/1113 A. Sasha and His Trip 题意: n个 ...
- Codeforces Round #373 (Div. 2) E. Sasha and Array 线段树维护矩阵
E. Sasha and Array 题目连接: http://codeforces.com/contest/719/problem/E Description Sasha has an array ...
随机推荐
- Code-NFine:变量修改
ylbtech-Code-NFine:Cookie变量修改 1. NFine.Code返回顶部 1.Operator 1.1.OperatorProvider.cs /**************** ...
- CSS counter计数器(content目录序号自动递增)详解
一.CSS计数器三角关系 CSS计数器只能跟content属性在一起的时候才有作用,而content属性貌似专门用在before/after伪元素上的.于是,就有了,“计数器↔伪元素↔content属 ...
- Meta标签中的format-detection属性及含义(转)
一.Meta标签中的format-detection属性及含义 意为:格式检测 或许你会有这样的经历:当你在制作手机端的页面中,点击了没有加任何链接的格式的数字时,这时手机会进行自动拔号提示操作! 禁 ...
- 1-1 课程导学 & 1-2 项目需求分析,技术分解.
1-1 课程导学 1-2 项目需求分析,技术分解. 要有一定的dart基础,了解安卓和ios的一些普通的开发
- Win10应用设计的那些事儿
此文已由作者杨凯明授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 继Windows 10系统发布之后,很多Windows用户更新了系统.win10系统的发布,在以往的metr ...
- bzoj 3667: Rabin-Miller算法【Miller-Rabin】
Miller-Rabin模板 #include<iostream> #include<cstdio> #include<algorithm> using names ...
- bzoj 2131: 免费的馅饼【dp+树状数组】
简单粗暴的dp应该是把馅饼按时间排序然后设f[i]为i接到馅饼能获得的最大代价,转移是f[i]=max(f[j])+v[i],t[j]<=t[i],2t[i]-2t[j]>=abs(p[i ...
- 修改 jq weui cityPicker.js原来的值
1.对接后台接口,拿到返回来的值,注意数据格式要一样 var raw; $.ajax({ type: "GET", url: "/web/region/list.json ...
- 键值编码 KVC
http://www.cnblogs.com/dyf520/p/3805297.html 1,什么是Key-Value Coding? Key-Value Coding是一种间接访问对象属性的机制,使 ...
- 第二类Stirling数初探 By cellur925
上午noi.ac崩崩崩了,栽在组合数学上,虽说最后在辰哥&Chemist的指导下A掉了此题,也发现自己组合数学太弱了qwq. 在luogu上找题,结果找到了一个第二类斯特林数的题(还是双倍经验 ...