Shooting Contest Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3812   Accepted: 1389   Special Judge Description Welcome to the Annual Byteland Shooting Contest. Each competitor will shoot to a target which is a rectangular grid. The t…
POJ 1719 Shooting Contest id=1719" target="_blank" style="">题目链接 题意:给定一个矩阵,每列有两个白点,其它都是黑点,如今要求每列选一个白点,使得每一行至少包括一个白点被选中 思路:二分图匹配,白点的位置行列建边,然后跑匹配,假设匹配数不等于行数,就是是无解,然后输出方案的时候注意,假设有位置是没匹配的,说明这个位置是多余的,可是还是要随意选一个白点来输出 代码: #include <…
http://poj.org/problem?id=1719 Shooting Contest Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4135   Accepted: 1521   Special Judge Description Welcome to the Annual Byteland Shooting Contest. Each competitor will shoot to a target whi…
[题目链接] http://poj.org/problem?id=3057 [题目大意] 给出一个迷宫,D表示门,.表示人,X表示不可通行, 每个门每时间单位只允许一个人通过, 每个人移动一格的为一时间单位的时间, 问所有人逃离这个迷宫的最小时间 [题解] 我们首先对于每个门进行搜索,求出其到每个人的最短时间, 之后我们将每扇门对于人来拆点,分别为这个人第几秒通过这个门 将拆点后的门对所有人做一遍顺序二分图匹配 匹配最终完成的时间的门是其第几个拆点那么时间就是第几秒 [代码] #include…
[题目链接] http://poj.org/problem?id=3041 [题目大意] 一个棋盘上放着一些棋子 每次操作可以拿走一行上所有的棋子或者一列上所有的棋子 问几次操作可以拿完所有的棋子 [题解] 每个棋子相当于是连接行列二分图的边,我们做一遍二分图匹配就是答案. [代码] #include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namesp…
题意 给定m个长度为n的01串(*既表示0 or 1.如*01表示001和101).现在要把这些串都删除掉,删除的方法是:①一次删除任意指定的一个:②如果有两个串仅有一个字符不同,则可以同时删除这两个.求最少要多少次可以删完,并且同一个串不能删两次. 思路 我们用点表示一个串,如果两个串之间只有一个字符不同,那么这两个串之间连接一条,最大匹配数就是节省的次数. 因为每个串中的1为奇数的串之间是不能匹配的(不可能只有1个不同),同理,偶数也是.所以,可以按照1的奇偶性把数据分成2份,所以是一个二分…
Description Professor Clumsey is going to give an important talk this afternoon. Unfortunately, he is not a very tidy person and has put all his transparencies on one big heap. Before giving the talk, he has to sort the slides. Being a kind of minima…
Description The gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x, y) coordinates. A hawk arrives and if a gopher does not reach a hole in s seconds it is vulnerable t…
点击打开链接题目链接 Treasure Exploration Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 7215   Accepted: 2947 Description Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you eve…
POJ 2195 Going Home (带权二分图匹配) Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a…