http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4836 因为要使对角线所有元素都是U,所以需要保证每行都有一个不同的列上有U,设(i,j)的位置是U, 以U为边,连接点i和点j+n,也即连接行点和列点,最大匹配为n则必定有解,否则必定无解 #include <cstdio> #include <iostream> #include <cstring> #include <cctype>…
Fire Net Time Limit: 2 Seconds      Memory Limit: 65536 KB Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small c…
Description:   You are given a matrix which <= n <= m <= ). You are supposed to choose n elements, there element element in the same column. What is the minimum value of the K_th largest in the n elements you have chosen.   Input:   First line ),…
题目链接:Taxi Taxi Time Limit: 1 Second      Memory Limit: 32768 KB As we all know, it often rains suddenly in Hangzhou during summer time.I suffered a heavy rain when I was walking on the street yesterday, so I decided to take a taxi back school. I foun…
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3914 对L研究可以发现 相当于黑-横白,黑-纵白,每个黑白都要被匹配到,其中黑的横纵各两次, 很自然的想到拆点,黑点拆成专门和横白连接的,专门和纵白连接的, 如果2*黑==白数,运行一次二分匹配算法,匹配数==白数则为可行,剩下的都不可行 #include <cstdi…
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2361 来源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26760#problem/B Beloved Sons Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Once upon a time there liv…
The Perfect Stall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 23313   Accepted: 10383 Description Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering p…
题意: 给你一副图, 有草地(*),空地(o)和墙(#),空地上可以放机器人, 机器人向上下左右4个方向开枪(枪不能穿墙),问你在所有机器人都不相互攻击的情况下能放的最多的机器人数. 思路:这是一类经典题的衍化,如果没有墙,我们会将行和列看成两列点阵,然后就可以用二分匹配解. 现在有墙怎么办呢, 把某一行或列(有墙的拆分成多个区域,可以看成多个行或列), 拆好以后更没有墙的做法一样了. #include <cstdio> #include <cstring> #include &l…
题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=4536">点击打开链接 题意: 给定n*n的棋盘, 能够在'.'上摆 象棋中的车(X是墙壁) 使得随意两个车都不能互相攻击到 问:最多能摆多少个车. 思路: 二分匹配 1.若没有X.那么做法就是 X点集为行,Y点集为列,对于图上的每一个点所在的行和列(x,y) 建一条边 x->y 2.有了X,那么对于每一个点所在的上方能接触到的X必须…
The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4080    Accepted Submission(s): 1430 Problem Description In the Kingdom of Silence, the king has a new problem. There are N cit…