最少顶点覆盖 = 二分图最大匹配 证明见   http://hi.baidu.com/keeponac/item/111e3438988c786b7d034b56…
Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17237   td>Accepted: 9375 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contain…
点击打开链接 Konig定理:二分图的最小顶点覆盖数 = 二分图的最大匹配数 题意: 在N*N的网络中有K颗小行星.小行星i的位置是(Ri, Ci).如今有一个强力的武器可以用一发光束将一整行或一整列的小行星消灭.想要利用这个武器消灭全部的小行星最少须要几发光束? 分析: 以小行星的左右坐标建立二分图,就能够看出是求二分图的最小顶点覆盖数. #include <cstdio> #include <cstring> #include <vector> #include &…
分析:这里使用树形DP做. 1.最小顶点覆盖做法:最小顶点覆盖 == 最大匹配(双向图)/2. 2.树形DP: dp[i][0]表示i为根节点,而且该节点不放,所需的最少的点数. dp[i][1]表示i为根节点,而且该节点放,所须要的最少的点数. dp[i][0]=sum(dp[son[i][j]][1]) 该点不放.则它的儿子节点必须都放,仅仅有这样之间的边才干够被覆盖. dp[i][1]=sum(min(dp[son[i][j]][0],dp[son[i][j]][1])) 该点放的话,则它…
Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conveniently located at the lattice points of the…
Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11958   Accepted: 5094 Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduli…
http://acm.hdu.edu.cn/showproblem.php?pid=1054 二分图最少顶点覆盖,模板题,双向边最后结果/2 #include <iostream> #include <cstdio> #include <cstring> using namespace std ; struct node{ int s,t,nxt ; }e[] ; ],vis[],match[],cnt,n,m ; int find(int s) { ;i=e[i].n…
题目大意就是说有两台机器,分别有n,m种模式可以调节,有k个工作,某一个工作i可以在第一台机器的a[i]模式下或第二台机器的b[i]模式下工作,两台机器的初始模式为0,问如何分配这K件工作使得两台机器更换模式的次数最少.并难求最少次数. 这里有一个定理: 二分图的最少顶点覆盖 = 二分图的最大匹配 证明见http://hi.baidu.com/keeponac/item/111e3438988c786b7d034b56 感觉讲的不错,仔细看看,慢慢就会明白. #include <map> #i…
Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22905   Accepted: 12421 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K a…
Strategic Game Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8503    Accepted Submission(s): 4093 Problem Description Bob enjoys playing computer games, especially strategic games, but somet…