poj 2983Is the Information Reliable?】的更多相关文章

http://poj.org/problem?id=2983 #include<cstdio> #include<cstring> #include<algorithm> #define maxm 5000100 #define maxn 3010 using namespace std; int head[maxn],next[maxn],dis[maxn]; bool vis[maxn]; int e,n,m; <<; struct node { int…
Description The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line with N defense stations. Because of the cooperation of the stations, Zibu…
题目地址:POJ 2983 题意:有N个车站.给出一些点的精确信息和模糊信息.精确信息给出两点的位置和距离.模糊信息给出两点的位置.但距离大于等于一.试确定是否全部的信息满足条件. 思路:事实上就是让你推断是否存在负环.好久才看明确.对于精确消息.能够得出两个差分公式:dis[v] <= dist[u] - w  &&  dist[u] <= dist[v] + w.对于模糊信息.能够得出dis[v] <= dis[u] -1. PS:做差分约束感觉还是Bellman_f…
Description The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line with N defense stations. Because of the cooperation of the stations, Zibu…
id=2983">[POJ 2983]Is the Information Reliable? (差分约束系统) Is the Information Reliable? Time Limit: 3000MS   Memory Limit: 131072K Total Submissions: 12244   Accepted: 3861 Description The galaxy war between the Empire Draco and the Commonwealth of…
B - Is the Information Reliable? Time Limit:3000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I64u Submit Status Description The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a l…
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=267#problem/B                        B - Is the Information Reliable? Time Limit:3000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I64u Description The galaxy war between the Empi…
Is the Information Reliable? Time Limit: 3000MS   Memory Limit: 131072K Total Submissions: 11125   Accepted: 3492 Description The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defe…
http://poj.org/problem?id=2983 题意:N 个 defense stations,M条消息,消息有精确和模糊之分,若前边为P.则为精确消息,有两个defense stations和他们之间的距离,若为P A B X 则是精确消息,并且A在B北边X光年远,V A B则是模糊消息,A在B北边,不知道距离,但至少是1光年远. 思路 :这个题要转化成差分约束.因为dist[a]-dist[b] = x,所以转化成差分约束x<=dist[a]-dist[b]<=x ,模糊消息…
题链: http://poj.org/problem?id=2983 题解: 差分约束. 1).对于条件(P u v w),不难发现反映到图上就是: $dis[u]-dis[v]=w$,所以添加两条边: u → v : -w v → u : w 2).对于条件(V,u,v),反映到图上即为: $dis[u]-dis[v]>=1$,所以添加一条边: v → u : 1 建好图后,dfs版spfa判一下是否存在正环就好了. (出现正环代表Unreliable,否则就是Reliable) 代码: #i…