题目链接: E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by…
E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the n…
题目链接:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks y…
XOR and Favorite Number time limit per test: 4 seconds memory limit per test: 256 megabytes input: standard input output: standard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pa…
原来我直接学的是假的莫队 原题: Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ≤ i ≤ j ≤ r and the xor of the nu…
莫队算法. #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; +; int a[maxn],pre[maxn]; *maxn]; int pos[maxn]; int n,m,k; long long ans[maxn]; long long Ans; int L,R; struct X { int l,r,id; }s[ma…
Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ≤ i ≤ j ≤ r and the xor of the numbers ai, ai + 1,…
#include<bits/stdc++.h> using namespace std; <<; struct node{ int l,r; int id; }q[N]; int pos[N]; long long ans[N]; //每个前缀值出现的次数 long long flag[N]; int a[N]; bool cmp(node a,node b) { //如果左端点在同一块中,按右端点排序 if(pos[a.l]==pos[b.l]) return a.r<b.…
任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks yo…
E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pai…
E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pai…
D. Powerful array time limit per test seconds memory limit per test megabytes input standard input output standard output An array of positive integers a1, a2, ..., an ..., ar, ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of occ…