2014多校10(1005)hdu4975(网络流isap+判断唯一性)
2014-08-22 18:13
204 查看
A simple Gaussian elimination problem.
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 658 Accepted Submission(s): 221
Problem Description
Dragon is studying math. One day, he drew a table with several rows and columns, randomly wrote numbers on each elements of the table. Then he counted the sum of each row and column. Since he thought the map will be useless after he got the sums, he destroyed
the table after that.
However Dragon's mom came back and found what he had done. She would give dragon a feast if Dragon could reconstruct the table, otherwise keep Dragon hungry. Dragon is so young and so simple so that the original numbers in the table are one-digit number (e.g.
0-9).
Could you help Dragon to do that?
Input
The first line of input contains only one integer, T(<=30), the number of test cases. Following T blocks, each block describes one test case.
There are three lines for each block. The first line contains two integers N(<=500) and M(<=500), showing the number of rows and columns.
The second line contains N integer show the sum of each row.
The third line contains M integer show the sum of each column.
Output
Each output should occupy one line. Each line should start with "Case #i: ", with i implying the case number. For each case, if we cannot get the original table, just output: "So naive!", else if we can reconstruct the table by more than one ways, you should
output one line contains only: "So young!", otherwise (only one way to reconstruct the table) you should output: "So simple!".
Sample Input
3 1 1 5 5 2 2 0 10 0 10 2 2 2 2 2 2
Sample Output
Case #1: So simple! Case #2: So naive! Case #3: So young!
题意:给出n行,m列的和,然后每个格子只能是0~9的数,问你有没有一种填数的方案使得满足给出的数据
思路:这题跟hdu4888基本是一模一样,但这题比较卡时间,网络流dinic,isap都能过,时间卡在最后的判环,只要在找环的时候边dfs边把走过的边删掉就好了
相关文章推荐
- HDU 4975 (杭电多校 #10 1005题)A simple Gaussian elimination problem.(网络流之最大流)
- hdu4975 行列和构造矩阵(dp判断唯一性)
- 任意大于10正整数反序输出,关判断是否回文数
- 餐巾计划问题[网络流24题之10]
- [hdu4888]最大流,判断最大流唯一性
- 10_小米监控Open-Falcon告警判断-Judge
- hdu4975A simple Gaussian elimination problem.【网络流判断是否解唯一】
- 判断一个10*10的矩阵是否为单位矩阵
- BZOJ3532 [Sdoi2014]Lis 【网络流退流】
- Android设备唯一性判断
- 2014-10总结:-有道笔记整理
- SpringMVC+ExtJS 实现文本框内容的唯一性判断
- MST唯一性判断
- [再寄小读者之数学篇](2014-10-18 利用 Lagrange 中值定理求极限)
- 快速判断一个数能否被1、2、3、4、5、6、7、8、9、10、11、12、13、17、19、23等整除的规律总结
- MyEclipse 10, 2013, 2014 破解、注册码
- poj--1637--Sightseeing tour(网络流,最大流判断混合图是否存在欧拉图)
- MyEclipse 10、2013、2014破解图文详细教程
- HDoj 2014 判断互质
- A simple Gaussian elimination problem.(hdu4975)网络流+最大流