传送门 01trie板子题. 给出两个数列,允许把第二个数列重新排列. 求使得两个数列每个位置对应的数的异或值和成为最小值的每个位置的异或和. 把第二个数列插入到01trie里面然后对于第一个数列中的数挨个询问最小异或和即可. 代码: #include<bits/stdc++.h> #define ri register int using namespace std; const int N=3e5+5,P=30; int n,son[N*30][2],siz[N*30],a[N],tot=…
题目链接:http://codeforces.com/problemset/problem/665/E (http://www.fjutacm.com/Problem.jsp?pid=2255) 题意:找出有多少个连续的区间[l,r](1 ≤ l ≤ r ≤ n),该区间中所有的数的异或值大于等于k: 思路:首先,如果是单看题目的话,会发现暴力的话复杂度是O(n^3),但是我们先预处理异或前缀和,然后你会发现[l,r]区间的异或和等于s[l-1]^s[r],这样就可以O(n^2)的求…
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires. Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and…
C. Perfect Security time limit per test3.5 seconds memory limit per test512 megabytes inputstandard input outputstandard output Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alic…
传送门 D. Good Substrings time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad. A s…