Challenge of Wisdom Time Limit: 2 Seconds Memory Limit: 32768 KB Background "Then, I want to know whether you're a wise boy!" Problem "I have a great deal of lands. They're divided into N*M grids (N, M <= 1,000,000,000). When you ar…
Longest common subsequence problem The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences). It differs from the longest common substring p…
题目链接:BZOJ - 1143 题目分析 这道题在BZOJ上只要求输出可选的最多的祭祀地点个数,是一道求最长反链长度的裸题. 下面给出一些相关知识: 在有向无环图中,有如下的一些定义和性质: 链:一条链是一些点的集合,链上任意两个点x, y,满足要么 x 能到达 y ,要么 y 能到达 x . 反链:一条反链是一些点的集合,链上任意两个点x, y,满足 x 不能到达 y,且 y 也不能到达 x. 那么很显然这道题就是求最长反链长度了. 一个定理:最长反链长度 = 最小链覆盖(用最少的链覆盖所有…