最大点独立集就是无向图中最多的两两不相邻的点集. 二分图最大点独立集=顶点数-二分图最大边独立集(二分图最大匹配) 这一题男女分别作YX部,如果x和y有浪漫关系则连边,如此构造二分图,答案显然就是最大点独立集.另外要先进行二分图染色,以确定每个id的性别. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define IN…
题目 Source http://www.lightoj.com/volume_showproblem.php?problem=1171 Description Given an m x n chessboard where some of the cells are broken. Now you are about to place chess knights in the chessboard. You have to find the maximum number of knights…
http://www.lydsy.com/JudgeOnline/problem.php?id=1143 题意: 思路: 二分图最大点独立集,首先用floyd判断一下可达情况. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m,tot; ][],mark[],head[]; ]; struct node { int v,next; }e[]; void a…
Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 11097   Accepted: 4960 Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically in…
Girls and Boys Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) [Problem Description] the second year of the university somebody started a study on the romantic relations between the students. The relation “romant…
http://www.lydsy.com/JudgeOnline/problem.php?id=4808 题意: 思路: 这图中的两个马只能选一个,二选一,很像二分图吧,对能互吃的两个棋子连线,在所选的任意两个棋子中,都不能互相有连线,这不就是最大点独立集吗? 最大独立集 = 顶点个数 - 最大匹配.记得把坏了的格子去掉. #include<iostream> #include<cstdio> #include<cstring> using namespace std;…
(上不了p站我要死了,侵权度娘背锅) Description 众所周知,马后炮是中国象棋中很厉害的一招必杀技."马走日字".本来,如果在要去的方向有别的棋子挡住(俗称"蹩马腿"),则不允许走过去.为了简化问题,我们不考虑这一点.马跟马显然不能在一起打起来,于是rly在一天再次借来了许多许多的马在棋盘上摆了起来--但这次,他实在没兴趣算方案数了,所以他只想知道在N×M的矩形方格中摆马使其互不吃到的情况下的最多个数.但是,有一个很不幸的消息,rly由于玩得太Happy,…
Guardian of Decency Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 6133   Accepted: 2555 Description Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he is afraid that…
http://poj.org/problem?id=1466 Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 11085   Accepted: 4956 Description In the second year of the university somebody started a study on the romantic relations between the students…
Girls and Boys Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://poj.org/problem?id=1466 Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved&q…