摘要:
题目描述 Two players, Petyr and Varys, play a game in which players remove stones from N piles in alternating turns. Petyr, in his turn, can remove at mos 阅读全文
摘要:
问题形式 有n个位置1...n,每个位置上有ai个石子。有两个人轮流操作。操作步骤是:挑选1...n中任一一个存在石子的位置i,将至少1个石子移动至i−1位置(也就是最后所有石子都堆在在0这个位置)。谁不能操作谁输。求先手必胜还是必败。 结论 问题等价于,求位置为奇数的ai的异或和,若异或和等于0, 阅读全文
摘要:
SG(x)=mex({SG(y1),SG(y2),...SG(yk))}) 阅读全文
摘要:
7720: RGB Coloring 题目描述 Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint som 阅读全文
摘要:
next_permutation:由原排列得到字典序中下一次最近排列 prev_permutation:由原排列得到字典序中上一次最近排列 阅读全文
摘要:
const int maxn=1e5+7; const int maxm=1e5+7; const int inf=0x3f3f3f3f; struct Dinic { struct Edge { int next,f,to; } e[maxm]; int head[maxn],dep[maxn],tol,ans; int cur[maxn... 阅读全文
摘要:
拓扑排序模板: 例题: Sorting It All Out 题目描述 An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order 阅读全文
摘要:
遍历即将树的所有结点访问且仅访问一次。 按照根节点位置的不同分为前序遍历,中序遍历,后序遍历。 一:前序遍历 1. 访问根结点; 2. 遍历左子树; 3. 遍历右子树。 二:中序遍历 1. 遍历左子树; 2. 访问根结点; 3. 遍历右子树。 三:后续遍历 1. 遍历左子树; 2. 遍历右子树; 3 阅读全文
摘要:
题目描述 一个由小括号组成的字符串可以被称为一个括号序列。但一个括号序列可能并不满足括号匹配的要求。因此,我们可以进一步将满足括号匹配的括号序列成为“标准的括号序列。例如字符串")((())"是一个括号序列但不是标准的括号序列,而字符串"()(())"是一个标准的括号序列。给定一个括号序列,你需要对 阅读全文