题解:对每一位分别考虑贡献 先求前缀和 按照二进制减法分类讨论,求出最终这一位是1还是0 用树状数组维护 注意:树状数组对0这个位置单独考虑 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int u=1000000; const int maxn=100009; int n; int ans; int a[maxn]; inline int lowbit(…
题面 戳这里 简要题解 做法一 因为所有数的和才100w,所以我们可以直接求出所有区间和. 直接把前缀和存到一个权值数组,再倒着存一遍,大力卷积一波. 这样做在bzoj目前还过不了,但是luogu开O2,最慢的点才500ms左右. #include<bits/stdc++.h> #define For(i,x,y) for (register int i=(x);i<=(y);i++) #define Dow(i,x,y) for (register int i=(x);i>=(y…
蛤?这一年cqoi的题这么水???? 这不就是个sb莫队吗 这样写怕是会被打死,,, 注意\(a_x\ XOR a_{x+1}\ XOR\ ...\ a_{y}=s_{x-1}\ XOR\ s_y\),所以问题转化为两个数异或值为k的方案数 所以记录一下当前区间的值域和当前区间的答案就星了.. // It is made by XZZ #include<cstdio> #include<algorithm> #include<cmath> #define il inli…