称号:Cat vs. DogTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 219 Accepted Submission(s): 86Probl...
分类:
其他好文 时间:
2015-09-17 13:12:08
阅读次数:
238
题目链接:codeforces 340D题目大意:给出一个程序,就是冒泡排序,每次如果发现相邻两个数前一个大于后一个,交换位置后建边,问最后得到的这个图中的最大独立集,这个最大独立集定义为所有的点都不相邻的最大点的集合的规模。题目分析:
首先我们可以知道对于a[i],它只会且一定会与后面的比它小的建边,所以我们只需要固定第一个点,然后找最长上升子序列即可。(这样能够保证没有相邻的点)
定义状态dp[...
分类:
其他好文 时间:
2015-09-15 18:34:42
阅读次数:
207
树的最大独立集,但是要判断唯一性。有些像是dfs。另外发现std::ios::sync_with_stdio(0)不能与scanf并用! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define pb pu...
分类:
其他好文 时间:
2015-09-13 15:54:02
阅读次数:
239
DescriptionIn a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also know each other. In addition to that, s...
分类:
其他好文 时间:
2015-08-31 21:19:31
阅读次数:
161
DescriptionIn the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically in...
分类:
其他好文 时间:
2015-08-31 19:17:44
阅读次数:
138
图的独立集:寻找一个点集,其中任意两点在图中无对应边二分图的最大独立集=图的点数-最大匹配数 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct people 9...
分类:
其他好文 时间:
2015-08-28 12:30:23
阅读次数:
131
Girls and Boys
Time Limit: 5000MS
Memory Limit: 10000K
Total Submissions: 11141
Accepted: 4983
Description
In the second year of the university somebody started a study...
分类:
其他好文 时间:
2015-08-27 18:45:21
阅读次数:
157
链接:http://www.lightoj.com/volume_showproblem.php?problem=1201最大独立集= 顶点数- 最大匹配代码:#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-08-26 22:28:06
阅读次数:
200
题目链接:点击打开链接
题目描述:现有一棵树,树上每个结点都有一个权值,问从中选一些点,这些点两两之间不直接连接,问权值最大为多少?
解题思路:很裸的一道树上最大独立集问题 树形dp即可
dp[i][0]:不选i节点 dp[i][0]+=max(dp[t][0],dp[t][1]);
dp[i][1]:选i节点 dp[i][1]+=dp[t][0];
代码:
#pragma c...
分类:
其他好文 时间:
2015-08-26 12:09:25
阅读次数:
147
Girls and BoysTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8863Accepted Submission(s): 4077Pr...
分类:
其他好文 时间:
2015-08-20 22:10:19
阅读次数:
285