来源:http://acm.hdu.edu.cn/showproblem.php?pid=2063 题意: 有k个组合a,b组合,代表a愿意与b坐过山车,共m个女生 n个男生,问有多少个满意的匹配 题解: 这是一道匈牙利算法的裸题,用递归询问是否能安排好某个女生,如果能就ans++ 注意,在同一回合的询问中,某个女生只寻找一次其它男生,第二次寻找时一定无法找到,直接返回0就行 这是我第二次做这道题,在前几个月已经做过,没想到这就是传说中的二分图  Orz #include<iostream>…
过山车 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22693    Accepted Submission(s): 9797 Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了.可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做par…
题目链接:HDU 2063 Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了.可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐.但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partner.考虑到经费问题,boss刘决定只让找…
http://acm.hdu.edu.cn/showproblem.php?pid=2063 过山车 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 14056    Accepted Submission(s): 6196 Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车…
题意:一个N*N的01矩阵,行与行.列与列之间可以互换.要求变换出一个对角线元素全为1的矩阵,给出互换的行号或列号. 分析:首先一个矩阵若能构成对角线元素全为1,那么矩阵的秩为N,秩小于N的情况无解.所以一个矩阵可以仅通过行变换不能得到最后结果,那么仅通过列变换或者行列变换都不能得到. 可以将行号看作二分图的X部,列号对应二分图Y部,那么矩阵Mij为1就可以视作第i行可以与第j列相匹配.而构成对角线全1的情况就是行与列之间有N对匹配关系,若小于N则无解. 根据所给的矩阵建二分图跑匈牙利,然后可以…
过山车 Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 48   Accepted Submission(s) : 23 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的…
Kingdom of Obsession Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 49    Accepted Submission(s): 14 Problem Description There is a kindom of obsession, so people in this kingdom do things very…
The Perfect StallHal Burch Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the new barn are different. For the first week, Farmer John r…
http://acm.hdu.edu.cn/showproblem.php?pid=2444 [DFS染色] #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> using namespace std; ; const int maxm=maxn*maxn; struct e…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3565    Accepted Submission(s): 1659 Problem Description There are a group of students. Some of them may know each ot…