随笔分类 - 位运算
1
摘要:XOR
阅读全文
摘要:Gambling Nim
阅读全文
摘要:Substrings in a String
阅读全文
摘要:题意:给定$a[1...n]$,求$(a_i⊕a_i+1⊕...⊕a_j)+(a_p⊕a_{p+1}⊕...⊕a_{q})$的最大值,其中$1≤i≤j= 0; k ){ c=((x k)&1); if(!ch[now][c]){ ch[tot][0]=ch[tot][1]=0; sz[tot]=0;
阅读全文
摘要:```C++ /*H E A D*/ struct Trie{ int son[maxn>i)&1; rrep(i,32,0){ if(!son[now][b[i]]){ son[now][b[i]]=++tot; son[tot][0]=son[tot][1]=0; ...
阅读全文
摘要:```C++ / H E A D / int main(){ int T=read(); while(T ){ ll a=read(); ll b=read(); ll c=read(); ll d=read(); ll ans=0; ll x=0,y=0; rrep(i,61,0){ bool p
阅读全文
摘要:我对莫队算法最为纠结的地方就是区间端点处,应该是像代码里那样理解吧 cnt[i]表示i出现的次数 maxn开2e6比较保险
阅读全文
摘要:```C++ / H E A D / struct Trie{ int son[maxn i)&1; rrep(i,32,0){ if(!son[now][b[i]]){ son[now][b[i]]=++tot; son[tot][0]=son[tot][1]=0; } now=son[now][
阅读全文
摘要:依然是异或运算,这次是限制L,R范围内挑2个数使其异或值最大 如果r最高为是pos,那最理想状态当然是(1ll l r){ if(l r) swap(l,r); if(l==r){ cout i)&1){ pos=i; break; } } coutj k 0),无论如何异或,2^i是无效的,这时的
阅读全文
摘要:求[1,n]内k的值的异或和使其值最大 k=1是肯定是n k 1,设pos是n的最高位,那答案就是(1ll
阅读全文
摘要:异或关于前缀的特性:[u,v]=[1,u]^[1,v] 注意是路径,假设1为根,prexor[1]不保留数值 C++ / H E A D / int to[maxn =1; } rrep(i,31,0){ if(!son[now][b[i]]) son[now][b[i]]=++tot; now=s
阅读全文
1