摘要: 今天第一次做差分约束系统的题,以前看过不过没用看太明白就放了,今天再次静下来好好的把它pass了,看了几个小时就找了道题做,中间有一个细节一直没太明白,就是关于边界为什么要加一或者减一。晚上的时候跟超神聊时,他提了下 我就突然明白了,这样是为了边界点不被重负计算。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define MAX_INT 123456789 6 struct node 7 { 8 int v; 9 阅读全文
posted @ 2011-08-25 19:59 我们一直在努力 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 题意就不说了,说下注意的地方,第一数据量很大必须用邻接表,第二输入的边有重边,第三题目给的最大和的范围有错,应给用64位。这样都注意了再加上SPFA就可以顺利的PASS。View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 using namespace std; 5 const int N=1000005; 6 const int inf=1000000000; 7 struct ss{ 8 int y,value,next; 9 }edge[N],redge[N]; 阅读全文
posted @ 2011-08-25 14:11 我们一直在努力 阅读(216) 评论(0) 推荐(0) 编辑