夏夜、

心若平似镜、何题不AC。

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页

2014年3月29日

UVA 11374 Airport Express 最短路

摘要: 分别求出以S和E为起点的最短路,然后枚举每一张商务票 (u,v)求 A(u) + w(u,v) + B(v)//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long 阅读全文

posted @ 2014-03-29 19:16 BMan、 阅读(243) 评论(0) 推荐(0) 编辑

2014年3月24日

UVA 10319 Manhattan 2-sat

摘要: 不难想到是2-sat,这题最繁的就是加边的了//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb 阅读全文

posted @ 2014-03-24 14:21 BMan、 阅读(164) 评论(0) 推荐(0) 编辑

2014年3月23日

UVA 1357 Cells

摘要: 考虑一颗普通的树,DFS一遍后得到每个点的DFS前序历遍顺序值dfsid[] ,和以改点为根的子树的总结点数num[]。(比如第一组样例dfsid[]={0,1,6,8,2,3,7,9,4,5} num[]={10,5,2,2,1,3,1,1,1,1});那么要判断a是否为b的祖先,只要满足dfsid[a]#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;t 阅读全文

posted @ 2014-03-23 23:12 BMan、 阅读(271) 评论(0) 推荐(0) 编辑

UVA 610 Street Directions 双连通分量

摘要: 首先找到全部双连通分量,然后对于某一个结点数大于2的连通分量,可以把全部的边改成单向的,按DFS的顺序。结点数为2的也就是一条为桥的边,必须保持双向。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typed 阅读全文

posted @ 2014-03-23 18:02 BMan、 阅读(173) 评论(0) 推荐(0) 编辑

UVA 11504 Dominos 强连通分量

摘要: 找出强连通分量,缩点后统计入度为0的结点数。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb 阅读全文

posted @ 2014-03-23 17:48 BMan、 阅读(154) 评论(0) 推荐(0) 编辑

UVA 11080 Place the Guards 二分图判定

摘要: 每个连通块分别取min{白色,黑色}//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) 阅读全文

posted @ 2014-03-23 17:46 BMan、 阅读(170) 评论(0) 推荐(0) 编辑

UVA 11294 Wedding 2sat

摘要: 训练指南上的翻译错了,只有一对新娘新郎,其他是夫妻。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#defin 阅读全文

posted @ 2014-03-23 17:44 BMan、 阅读(152) 评论(0) 推荐(0) 编辑

UVA 10765 Doves and bombs 双连通分量

摘要: //#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#define INF 阅读全文

posted @ 2014-03-23 17:42 BMan、 阅读(114) 评论(0) 推荐(0) 编辑

UVA 11396 Claw Decomposition 二分图判定

摘要: //#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#define INF 阅读全文

posted @ 2014-03-23 17:39 BMan、 阅读(171) 评论(0) 推荐(0) 编辑

2014年3月19日

UVA 1391 Astronauts 2-sat

摘要: //#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#define INF 阅读全文

posted @ 2014-03-19 23:21 BMan、 阅读(182) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页

导航