King Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12056 Accepted: 4397 Description Once, in one kingdom, there was a queen and that queen was expecting a baby. The queen prayed: ``If my child was a son and if only he was a sound kin…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1531 差分约束的题之前也碰到过,刚好最近正在进行图论专题的训练,就拿来做一做. ①:对于差分不等式,a - b <= c ,建一条 b 到 a 的权值为 c 的边,求的是最短路,得到的是最大值 ②:对于不等式 a - b >= c ,建一条 b 到 a 的权值为 c 的边,求的是最长路,得到的是最小值 ③:存在负环的话是无解 .④:求不出最短路(dist[ ]没有得到更新)的话是任意解 说明一下为…
THE MATRIX PROBLEM Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8016 Accepted Submission(s): 2092 Problem Description You have been given a matrix CN*M, each element E of CN*M is positive…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1534 思路:设s[i]表示工作i的开始时间,v[i]表示需要工作的时间,则完成时间为s[i]+v[i].于是可以列出下列不等式: FAS a b :b开始之后a结束,s[a]+v[a]>=s[b]; FAF a b :b结束之后a结束,s[a]+v[a]>=s[b]+v[b]; ASF a b :b结束之后a开始,s[a]>=s[b]+v[b]; ASA a b :b开始之后a开始,…
思路:设dis[i]为从0点到第i点的序列总和.那么对于A B gt k 来讲意思是dis[B+A]-dis[A]>k; 对于A B lt k来讲就是dis[B+A]-dis[A]<k;将两个不等式都化为 dis[A]-dis[B+A]<=-k-1; dis[A+B]-dis[A]<=k-1;那么就可以根据公式来建边了,用bellman_ford算法判断是否存在负圈就行了. #include<iostream> #include<cstdio> #inc…
Schedule Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1715 Accepted Submission(s): 757Special Judge Problem Description A project can be divided into several parts. Each part shoul…
House Man Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2410 Accepted Submission(s): 978 Problem Description In Fuzhou, there is a crazy super man. He can’t fly, but he could jump from hous…