2016年1月4日

codeforces 464C. Substitutes in Number

摘要: 题目链接C. Substitutes in Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndrew and Eugene are... 阅读全文

posted @ 2016-01-04 18:19 yohaha 阅读(216) 评论(0) 推荐(0) 编辑

codeforces 463E . Caisa and Tree

摘要: 题目链接 给一棵树, 两种操作, 一种是将点u的权值改为y, 另一种是查询根节点到点u的路径上, gcd(v, u)>1的深度最深的点v。 修改操作不超过50次。 这个题, 暴力可以过, 但是在cf上找到了一个神奇的代码。  如果没有修改, 那么就将询问存起来。 如果有了修改, 就dfs一次, 将之 阅读全文

posted @ 2016-01-04 16:42 yohaha 阅读(225) 评论(0) 推荐(0) 编辑

codeforces 464B Restore Cube

摘要: 题目链接给8个点, 判断这8个点能否组成一个正方体, 如果能, 输出这8个点。 同一个点的x, y, z可以交换。每一个点有6种排列方式, 一个8个点, 暴力枚举出所有排列方式然后判断能否组成正方体。 判断的方法看代码。#include #include #include #include #inc... 阅读全文

posted @ 2016-01-04 15:10 yohaha 阅读(240) 评论(0) 推荐(0) 编辑

poj 2774 Long Long Message 后缀数组

摘要: 题目链接求两个字符串的最长公共子串。将两个字符串连接起来, 然后找height的最大值, 还要注意此时的sa[i]和sa[i-1]不能在同一个串中。#include #include #include #include #include #include #include #include #inc... 阅读全文

posted @ 2016-01-04 12:32 yohaha 阅读(175) 评论(0) 推荐(0) 编辑

spoj 694 Distinct Substrings 后缀数组

摘要: 题目链接求一个字符串中不相同的子串的个数。子串的总数是(n+1)*n/2, 减去height[i]就可以。#include #include #include #include #include #include #include #include #include #include #includ... 阅读全文

posted @ 2016-01-04 11:14 yohaha 阅读(139) 评论(0) 推荐(0) 编辑

poj 3261 Milk Patterns 后缀数组

摘要: 题目链接求可重叠k次的最长子串。二分子串长度x, 将height数组分组, 看是否有一组中的数量大于等于k。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #... 阅读全文

posted @ 2016-01-04 10:58 yohaha 阅读(139) 评论(0) 推荐(0) 编辑

导航