摘要: 题意是:fy作为班长,分发糖果给每个孩子,而分发的过程要满足一个约束条件就是 B - A <= C 表示B所得到的糖果不能比A多c个。问fy(n点代表)所能得到的糖果数量与sp(0点代表)所能得到的糖果数目的最大差值。 很明显的差分约束题目根据B - A <= C建立约束图,求最短路得到最大值。不过这里ka queue的实现。用stack来实现才能ac。。。#include <cstdio>#include <cstring>#include <iostream>#define maxn 30007#define maxm 150004using 阅读全文
posted @ 2012-06-23 16:39 E_star 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2983题意:给定两种约束关系Precise tip is in the form ofP A B X, means defense stationAisXlight-years north of defense stationB.Vague tip is in the form ofV A B, means defense stationAis in the north of defense stationB, at least 1 light-year, but the precise distance is unknown.d[i]表示 阅读全文
posted @ 2012-06-23 11:20 E_star 阅读(188) 评论(0) 推荐(0) 编辑