Shooting Contest Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4097   Accepted: 1499   Special Judge Description Welcome to the Annual Byteland Shooting Contest. Each competitor will shoot to a target which is a rectangular grid. The t…
匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名.匈牙利算法是基于Hall定理中充分性证明的思想,它是二部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法. #include<stdio.h> #include<string.h> #include<stdlib.h> int n1,n2; ][]; //数组开大点 ][],mapy[][]; ][];//邻接矩阵true代表有边相连 ],visit[]; in…
1.poj 2239   Selecting Courses   二分图最大匹配问题 2.总结:看到一个题解,直接用三维数组做的,很巧妙,很暴力.. 题意:N种课,给出时间,每种课在星期几的第几节课上,求最多可上几种课. #include<iostream> #include<cstring> #include<cstdio> using namespace std; ][][]; ][],pipei[][]; int findn(int n) { ;i<=;i+…
主要是学一下如何在广搜中记录路径:每找到一个点我就记录下这个点是由那个点得来的,这样我找到最后个点后,我就可以通过回溯得到我走过的路径,具体看代码吧~ #include<cstdio> #include<stdio.h> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<cstring> #include<…
题目大意: 在一个n*m的房间中 ‘X’为墙 ‘D’为门 ‘.’为人 门只存在与外围 人每秒钟只能向四连通区域走一步 门比较狭窄 每秒钟只能通过一个人 求所有人逃脱的最短时间 如果不可能则输出impossible 对每个门 广搜出能在这个门逃脱的人的逃出时间 将 对应各个时间的这个门 当做不同的点 即 若有d个门 p个人 时间1对应的门编号为 0~d-1 时间2对应的门编号为 d~2*d-1 时间t对应的门编号为 (t-1)*d~t*d-1 然后将人编号为 t*d~t*d+p-1 再将 对应时间…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22688   Accepted: 9626   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        f…
题意: 会给出M个串,我们要做的就是将这M个串给清除了.对于任意两个串,若二进制形式只有一位不一样,那么这两个串可以在一次操作消除,否则每个操作只能消除一个串. 3 3 *01 100 011 可以代表的串是 001 101 100 011 那么我们可以先用 10*把 101 和 100 消除了,再用 0*1把001 和 011 消除了.故操作次数为 2. 解题思路: 我们可以将所有的串先化为整数,并去重.然后对二进制形式只有一位不一样的两个数,我们由含有偶数个1的数向含有奇数个1的数连边,这样…
  Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17258   Accepted: 9386 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…
Air Raid Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7278   Accepted: 4318 Description Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an i…
思路:由(i+j)为偶数的点向(i+j)为奇数的点建边.求一次最大匹配,若正好为空格数(不包含洞)的一半,即输出YES. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define Maxn 1101 using namespace std; ][],N[Maxn],M[Maxn],x,y; int dfs(int u) { int i; ;i<=y…