码迷,mamicode.com
首页 >  
搜索关键字:差分约束    ( 573个结果
差分约束-zoj-2770
Burn the Linked Camp It is well known that, in the period of The Three Empires, Liu Bei, the emperor of the Shu Empire, was defeated by Lu Xun, a general of the Wu Empire. The defeat was due to Liu B...
分类:其他好文   时间:2014-06-20 12:57:12    阅读次数:240
poj 3169 Layout(差分约束)
poj 3169 Layout(图论-差分约束)...
分类:其他好文   时间:2014-06-18 11:32:08    阅读次数:217
POJ 1201 Intervals(图论-差分约束)
POJ 1201 Intervals(图论-差分约束) 题目大意: n行,每行a,b,c,表示在区间a,b内要找c个数,问你总共至少要找多少个数? 解题思路: 差分约束系统。 在本题中,如果[a,b]中要找c个元素,那么:s[b]-s[a-1]>=c,我们可以推得:s[a-1] - s[b] <= -c 同时,由于每一个值上最多只能含有一个元素,那么:s[i] - s[i-1]=0 推得:s[i-1] - s[i] <=0 这样:我们有了三个约束不等式: s...
分类:其他好文   时间:2014-06-18 08:05:51    阅读次数:245
POJ 3169 Layout (图论-差分约束)
POJ 3169 Layout (图论-差分约束) 题目大意: n头奶牛按1到n排好序,md个限制及mt个限制,md行表示奶牛A与奶牛B相差最多D,mt个限制奶牛A与奶牛B相差最少D,问你奶牛1与奶牛n最多相差多少? 解题思路: 限制条件 : 1、相邻奶牛之间,编号大的距离大于编号小的,即 dist[1]-dist[2]<=0,dist[2]-dist[3]<=0,dist[3]-dist[4]<=0。。。。dist[n-1]-dist[n]<=0 2、md个限制 A与奶牛B相差最多D,dist[A]...
分类:其他好文   时间:2014-06-18 06:07:39    阅读次数:209
poj 3169 差分约束
3169差分约束的是满足多组形如xi-yj=d[v] d[u]+dd=d[v] 建边(u,vdl)对于d[u]+dde的最短距离 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include...
分类:其他好文   时间:2014-06-16 06:46:23    阅读次数:313
POJ 1364 King --差分约束第一题
题意:求给定的一组不等式是否有解,不等式要么是:SUM(Xi) (a k (1) 要么是SUM(Xi) (a k,也就是T(a-1)-T(a+b) = K.不存在这个序列的情况即为出现负环,所以这题建图后只需判断有无负环即可。这里用Bellman-Ford算法判负环注意:(1)a-1有可能为0,a....
分类:其他好文   时间:2014-06-12 08:03:35    阅读次数:213
贪心 序列
题目:http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=517之前差分约束搞了一发,现在终于知道贪心了。对区间右端点排序,尽量从右端点取数。 数据比较小,n^2就行了。#include #include #include #include #include #inc...
分类:其他好文   时间:2014-06-11 08:21:10    阅读次数:276
差分约束Poj3159 Candies
没负环。直接搞就行,但是 spfa 队列会超时。#include #include #include #include #include #include #include #include #include #include #include int n;using namespace std;s...
分类:其他好文   时间:2014-06-07 09:02:03    阅读次数:200
差分约束Poj 3169 Layout
#include #include #include #include #include #include #include #include #include #include #include using namespace std;int n;const int INF=0xfffffff;s...
分类:其他好文   时间:2014-06-07 06:11:19    阅读次数:204
573条   上一页 1 ... 55 56 57 58 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!