Codeforces Round #539 (Div. 1) A. Sasha and a Bit of Relax description 给一个序列\(a_i\),求有多少长度为偶数的区间\([l,r]\)满足\([l,mid]\)的异或和等于\([mid+1,r]\)的异或和. solution 等价于询问有多少长度为偶数的区间异或和为\(0\). 只需要两个位置的异或前缀和与下标奇偶性相同即可组成一个合法区间. #include<cstdio> #include<algorith…
这里没有翻译 Codeforces Round #545 (Div. 1) T1 对于每行每列分别离散化,求出大于这个位置的数字的个数即可. # include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn(1005); int n, m, a[maxn][maxn], mx1[maxn][maxn], mx2[maxn][maxn], q[maxn], len; int main() { i…
Problem Codeforces Round #539 (Div. 2) - D. Sasha and One More Name Time Limit: 1000 mSec Problem Description Input The first line contains one string s (1≤|s|≤5000) — the initial name, which consists only of lowercase Latin letters. It is guarante…
Problem Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax Time Limit: 2000 mSec Problem Description Input The first line contains one integer n (2≤n≤3⋅10^5) — the size of the array. The second line contains n integers a1,a2,…,an (0≤ai<2^…
Codeforces Round #539 Div1 题解 听说这场很适合上分QwQ 然而太晚了QaQ A. Sasha and a Bit of Relax 翻译 有一个长度为\(n\)的数组,问有多少个长度为偶数的连续区间,使得其前一半的异或和等于后一半的异或和. 题解 显然就是求长度为偶数且异或和为\(0\)的区间个数 求异或和为\(0\)的区间个数很简单,对于整个区间求异或前缀和看看有多少个相等就好了. 求长度为偶数的也很简单,把每个位置的异或前缀和按照位置的奇偶性分开求个数每次计算一下…