POJ1274_The Perfect Stall(二分圖最大匹配),poj1274_thestall
解題報告
http://blog.csdn.net/juncoder/article/details/38136193
題目傳送門
題意:
n頭m個機器,求最大匹配。
ps
一分鐘前剛做了POJ1469 直接改了輸入輸出就交了,題意完全一樣,,,sad ,代碼傳送門
The Perfect Stall
| Time Limit: 1000MS |
|
Memory Limit: 10000K |
| Total Submissions: 18108 |
|
Accepted: 8227 |
Description
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 randomly assigned cows to stalls, but it quickly became clear that any given cow was only willing to produce milk in certain stalls. For the last week, Farmer John has been collecting data on which cows are willing to produce milk in which stalls. A stall may be only assigned to one cow, and, of course, a cow may be only assigned to one stall.
Given the preferences of the cows, compute the maximum number of milk-producing assignments of cows to stalls that is possible.
Input
The input includes several cases. For each case, the first line contains two integers, N (0 <= N <= 200) and M (0 <= M <= 200). N is the number of cows that Farmer John has and M is the number of stalls in the new barn. Each of the following N lines corresponds to a single cow. The first integer (Si) on the line is the number of stalls that the cow is willing to produce milk in (0 <= Si <= M). The subsequent Si integers on that line are the stalls in which that cow is willing to produce milk. The stall numbers will be integers in the range (1..M), and no stall will be listed twice for a given cow.
Output
For each case, output a single line with a single integer, the maximum number of milk-producing stall assignments that can be made.
Sample Input
5 52 2 53 2 3 42 1 53 1 2 51 2
Sample Output
4
ACM解題報告
一個POJ題目分類
主流演算法:
1.搜尋 //回溯
2.DP(動態規劃)
3.貪心
4.圖論 //Dijkstra、最小產生樹、網路流
5.數論 //解模線性方程
6.計算幾何 //凸殼、同等安置矩形的並的面積與周長
7.組合數學 //Polya 定理
8.類比
9.資料結構 //並查集、堆
10.博弈論
1、 排序
1423, 1694, 1723, 1727, 1763, 1788, 1828, 1838, 1840, 2201, 2376,
2377, 2380, 1318, 1877,1928, 1971, 1974, 1990, 2001, 2002, 2092, 2379,
1002(需要字元處理,排序用快排即可) 1007(穩定的排序) 2159(題意較難懂)
2231 2371(簡單排序) 2388(順序統計演算法) 2418(二叉排序樹)
2、 搜尋、回溯、遍曆
1022,1111,1118,1129,1190,1562,1564,1573,1655,2184 ,2225,2243,2312,2362,2378,2386,1010,1011,1018,1020,1054,1062,1256,1321,1363,1501,1650,1659,1664,1753,2078,2083,2303,2310,2329
簡單:1128, 1166, 1176, 1231, 1256, 1270, 1321, 1543, 1606, 1664,
1731, 1742, 1745, 1847,1915, 1950, 2038, 2157, 2182, 2183, 2381, 2386, 2426
不易:1024, 1054, 1117, 1167, 1708, 1746, 1775, 1878, 1903, 1966, 2046,
2197, 2349
推薦:1011, 1190, 1191, 1416, 1579, 1632, 1639, 1659, 1680, 1683, 1691,
1709, 1714, 1753,1771, 1826, 1855, 1856, 1890, 1924, 1935, 1948, 1979, 1980, 2170,2288, 2331, 2339,2340,1979(和迷宮類似),1980(對剪枝要求較高)
3、 曆法
1008 2080 (這種題要小心)
4、 枚舉
1012,1046, 1387, 1411, 2245, 2326, 2363, 2381,1054(剪枝要求較高),1650 (小數的精度問題)
5、 資料結構的典型演算法
容易:1182, 1656, 2021, 2023, 2051, 2153, 2227, 2236, 2247, 2352,
2395
不易:1145, 1177, 1195, 1227, 1661, 1834
推薦:1330, 1338, 1451, 1470, 1634, 1689, 1693, 1703, 1724, 1988, 2004,
2010, 2119, 2274
1125(弗洛伊德演算法) ,2421(圖的最小產生樹)
6、 動態規劃
1037 A decorative fence、
1050 To the Max、
1088 滑雪、
1125 Stockbroker Grapevine、
1141 Brackets Sequence、
1159 Palindrom......餘下全文>>
acm上的題目分類
我這有點資料,自己看看吧。
北大ACM(PKU JudgeOnline)題目分類
1.搜尋 //回溯
2.DP(動態規劃)
3.貪心
4.圖論 //Dijkstra、最小產生樹、網路流
5.數論 //解模線性方程
6.計算幾何 //凸殼、同等安置矩形的並的面積與周長
7.組合數學 //Polya定理
8.類比
9.資料結構 //並查集、堆
10.博弈論
1、 排序
1423, 1694, 1723, 1727, 1763, 1788, 1828, 1838, 1840, 2201, 2376, 2377, 2380, 1318, 1877, 1928, 1971,
1974, 1990, 2001, 2002, 2092, 2379,
1002(需要字元處理,排序用快排即可) 1007(穩定的排序) 2159(題意較難懂) 2231 2371(簡單排序)
2388(順序統計演算法) 2418(二叉排序樹)
2、 搜尋、回溯、遍曆
1022 1111d 1118 1129 1190 1562 1564 1573 1655 2184 2225 2243 2312 2362 2378 2386
1010,1011,1018,1020,1054,1062,1256,1321,1363,1501,1650,1659,1664,1753,2078
,2083,2303,2310,2329
簡單:1128, 1166, 1176, 1231, 1256, 1270, 1321, 1543, 1606, 1664, 1731, 1742, 1745, 1847, 1915, 1950,
2038, 2157, 2182, 2183, 2381, 2386, 2426,
不易:1024, 1054, 1117, 1167, 1708, 1746, 1775, 1878, 1903, 1966, 2046, 2197, 2349,
推薦:1011, 1190, 1191, 1416, 1579, 1632, 1639, 1659, 1680, 1683, 1691, 1709, 1714, 1753, 1771, 1826,
1855, 1856, 1890, 1924, 1935, 1948, 1979, 1980, 2170, 2288, 2331, 2339, 2340,1979(和迷宮類似) 1980(對剪枝
要求較高)
3、 曆法
1008 2080 (這種題要小心)
4、 枚舉
1012,1046, 1387, 1411, 2245, 2326, 2363, 2381,1054(剪枝要求較高),1650 (小數的精度問題
)
5、 資料結構的典型演算法
容易:1182, 1656, 2021, 2023, 2051, 2153, 2227, 2236, 2247, 2352, 2395,
不易:1145, 1177, 1195, 1227, 1661, 1834,
推薦:1330, 1338, 1451, 1470, 1634, 1689, 1693, 1703, 1724, 1988, 2004, 2010, 2119, 2274, 1125(弗洛伊德算
法) ,2421(圖的最小產生樹)
6、 動態規劃
......餘下全文>>