上一页 1 2 3 4 5 6 7 ··· 19 下一页
摘要: Problem D:题意:给定一棵n个点树,每个点有一个字母,有m个询问,每次询问某个节点x的子树中所有深度为k的点能否组成一个回文串分析:一堆点能组成回文串当且仅当数量为奇数的字母不多于1个,显然这个状态可以用二进制表示 那么对于单个询问如何快速找到所有符合要求的点呢? 这里可以考虑树... 阅读全文
posted @ 2015-08-15 15:04 PlasticSpirit 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题意: 求长度大于等于K的公共子串的个数。位置不同就算不同。后缀数组求依次SA LCP, 然后就是统计答案了, 暴力统计n^2复杂度显然不可以, 我们可以利用lcp数组的"部分单调性", 用一个栈,栈中保存小于等于当前lcp的原数组的下标,两次统计, 第一次统计, 按B串统计, 把A串大于等于K的那... 阅读全文
posted @ 2015-08-07 19:06 PlasticSpirit 阅读(397) 评论(0) 推荐(0) 编辑
摘要: In TouchTime Limit: 8000/4000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 178Accepted Submission(s): 44Problem Des... 阅读全文
posted @ 2015-08-06 21:17 PlasticSpirit 阅读(921) 评论(1) 推荐(0) 编辑
摘要: K-queryGiven a sequence of n numbers a1, a2, ..., anand a number of k- queries. A k-query is a triple (i, j, k) (1 ≤ i ≤... 阅读全文
posted @ 2015-08-05 22:32 PlasticSpirit 阅读(996) 评论(0) 推荐(0) 编辑
摘要: 题意:一颗树,定义一条路径的权值等于路径的边权之和,需要求这颗树所有路径中权值的最大值思路:考虑到路径权值与点权的最值有关,而最值的问题通常可以通过排序就行处理,于是想到先把点权排序。容易看出如果某条路径的权值是通过某个点算出的最小 ,那么肯定这条路径肯定不会经过权值更小的点,于是有了两种处理思路1... 阅读全文
posted @ 2015-07-28 11:25 PlasticSpirit 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 题意:N个点的有向树, Q次询问, 每次询问区间[L, R]内所有点的LCA。大致做法:线段树每个点保存它的孩子的LCA值, 对于每一次询问只需要 在线段树查询即可。 1 #include 2 using namespace std; 3 const int MAXN = 3e5+10; ... 阅读全文
posted @ 2015-06-08 21:00 PlasticSpirit 阅读(409) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/447/problem/E题意: 给定一个数组, m次操作,1 l r 表示区间修改, 每次 a[i] + Fibonacci[i-l+]2 l r 区间求和每次修改操作,只需要记录 每个点前两个值就可以了, 后面的和以及孩子需要加的值都可... 阅读全文
posted @ 2015-05-31 14:04 PlasticSpirit 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Justice StringGiven two strings A and B, your task is to find a substring of A called justice string, which has the same ... 阅读全文
posted @ 2015-05-19 13:07 PlasticSpirit 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 2038: [2009国家集训队]小Z的袜子(hose)Time Limit:20 SecMemory Limit:259 MBSubmit:3577Solved:1652[Submit][Status][Discuss]Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜... 阅读全文
posted @ 2015-05-02 23:35 PlasticSpirit 阅读(249) 评论(0) 推荐(0) 编辑
摘要: E. Infinite Inversions time limit per test ... 阅读全文
posted @ 2015-05-01 14:15 PlasticSpirit 阅读(448) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 19 下一页