摘要: 题目描述 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 阅读全文
posted @ 2019-04-27 22:01 oc_co 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 问题形式 有n个位置1...n,每个位置上有ai个石子。有两个人轮流操作。操作步骤是:挑选1...n中任一一个存在石子的位置i,将至少1个石子移动至i−1位置(也就是最后所有石子都堆在在0这个位置)。谁不能操作谁输。求先手必胜还是必败。 结论 问题等价于,求位置为奇数的ai的异或和,若异或和等于0, 阅读全文
posted @ 2019-04-02 10:16 oc_co 阅读(229) 评论(0) 推荐(1) 编辑
摘要: SG(x)=mex({SG(y1),SG(y2),...SG(yk))}) 阅读全文
posted @ 2019-04-01 11:42 oc_co 阅读(226) 评论(0) 推荐(1) 编辑
摘要: 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 阅读全文
posted @ 2019-03-27 16:52 oc_co 阅读(264) 评论(0) 推荐(1) 编辑
摘要: next_permutation:由原排列得到字典序中下一次最近排列 prev_permutation:由原排列得到字典序中上一次最近排列 阅读全文
posted @ 2019-03-07 18:00 oc_co 阅读(154) 评论(0) 推荐(1) 编辑
摘要: 线段树区间加法,区间乘法,区间查询 阅读全文
posted @ 2019-03-01 15:22 oc_co 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2019-01-24 22:02 oc_co 阅读(237) 评论(0) 推荐(1) 编辑
摘要: 拓扑排序模板: 例题: 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 阅读全文
posted @ 2019-01-22 21:04 oc_co 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 遍历即将树的所有结点访问且仅访问一次。 按照根节点位置的不同分为前序遍历,中序遍历,后序遍历。 一:前序遍历 1. 访问根结点; 2. 遍历左子树; 3. 遍历右子树。 二:中序遍历 1. 遍历左子树; 2. 访问根结点; 3. 遍历右子树。 三:后续遍历 1. 遍历左子树; 2. 遍历右子树; 3 阅读全文
posted @ 2019-01-18 15:16 oc_co 阅读(215) 评论(0) 推荐(1) 编辑
摘要: 题目描述 一个由小括号组成的字符串可以被称为一个括号序列。但一个括号序列可能并不满足括号匹配的要求。因此,我们可以进一步将满足括号匹配的括号序列成为“标准的括号序列。例如字符串")((())"是一个括号序列但不是标准的括号序列,而字符串"()(())"是一个标准的括号序列。给定一个括号序列,你需要对 阅读全文
posted @ 2019-01-16 19:31 oc_co 阅读(814) 评论(0) 推荐(1) 编辑