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 ...
随机推荐
- [POI 2014] Little Bird
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=3831 [算法] 单调队列优化动态规划 时间复杂度 : O(N) [代码] #incl ...
- Java中gcRoot和引用类型
看到一个老问题,Java是如何判定回收哪些对象的? 答:从gcRoot根搜索不可达,且标记清理一次之后仍没有被复活的对象,会被认定为垃圾对象进行清理.注意在Java中没有对象的作用域,只有对象的引用的 ...
- 酷版移动端iframe改变src,重新加载页面问题探究
最近在酷版上我要做一个内嵌别人的网页的在线服务页面,于是必须用到iframe,以前我以为移动端不支持iframe呢,原来这样都可以....(呵呵,长见识了!我还是只菜鸟) 直接入正题,说说我遇到的困难 ...
- 仿照 QQ 的 cell 的左滑删除、置顶、标记未读效果
侧滑删除.置顶.取消关注,在iOS8之前需要我们自定义,iOS8时苹果公司推出了新的API,UITableViewRowAction类,我们可以使用该类方便的制作出如下图的效果. 下面是实现的主要代码 ...
- vs 2015 community Blend和devenv启动的区别
使用Blend启动会有部分功能无法显示 如:SVN管理插件,工具栏 使用devenv启动会全部显示
- 009--test命令和grep作业及Sed作业awk作业和循环结构
一.test命令 -d :目录 test -d /boot -s :文件长度 > 0.非空 test - ...
- LIS LCS LCIS (主要过一遍,重在做题)
只详细讲解LCS和LCIS,别的不讲-做题优先. 菜鸟能力有限写不了题解,可以留评论,我给你找博客. 先得理解最长上升子序列吧,那个HDOJ拦截导弹系列可以做一下,然后用o(n)log(n)的在做一遍 ...
- [USACO10FEB]购买巧克力Chocolate Buying 【假背包真贪心】 By cellur925
题目传送门 继续dp刷题计划,看到这道题,第一眼感觉不就是显然的完全背包嘛.把背包打完要开始填充数组大小的时候成为了mengbier,发现数据极大,达到了1e18.显然这不是一道平凡的背包题目. 于是 ...
- (一)搭建自己的SpringBoot后台框架整合MyBatis
一:通过idea工具构建基础框架 1. 打开idea,左上角File→New→Project, 2. 点击Next 3. 点击Next,配置如下图,这里我们选择数据库MySQL和持久层框架MyB ...
- pycharm 断点调试
转自; https://blog.csdn.net/chenggong2dm/article/details/9368641 PyCharm 作为IDE,断点调试是必须有的功能.否则,我们还真不如用纯 ...