失踪百景

惯性生存者

导航

2015年12月25日 #

kuangbin_ShortPath D (POJ 3268)

摘要: 本来在想 单源多点很好解决但是多源单点怎么解 然后我发现只要倒过来就可以了把输入存下来然后 处理完dis1 重新init一次 倒着再输入一次 处理dis2 输出max(dis1[i] + dis2[i])#include #include #include #include #include #in... 阅读全文

posted @ 2015-12-25 21:45 失踪百景 阅读(153) 评论(0) 推荐(0) 编辑

2015年12月20日 #

kuangbin_UnionFind J (POJ 2492)

摘要: 加权并查集mod2模板 本体的难点是bug的释义(笑)#include #include #include #include #include #include #include #include #include using namespace std;int father[5005],sum[5... 阅读全文

posted @ 2015-12-20 01:06 失踪百景 阅读(137) 评论(0) 推荐(0) 编辑

kuangbin_UnionFind D (HDU 3038)

摘要: 加权并查集 似乎就是在想这题的时候突然理解了之前看E题没看懂的标准加权解法值得注意的技巧 为了让区间之前连成树 形式设定为为(l, r] 接受l的输入后先自减一下就可以了#include #include #include #include #include #include #include #i... 阅读全文

posted @ 2015-12-20 01:03 失踪百景 阅读(152) 评论(0) 推荐(0) 编辑

kuangbin_UnionFind C (HDU 1213)

摘要: 过程模板 扫一下一共有几棵树 输出#include #include #include #include #include #include #include #include #include #define MAX 1010using namespace std;int father[MAX],... 阅读全文

posted @ 2015-12-20 00:58 失踪百景 阅读(114) 评论(0) 推荐(0) 编辑

kuangbin_UnionFind B (POJ 1611)

摘要: 过程是模板 merge完后扫一下几个跟0同祖先节点就是答案了#include #include #include #include #include #include #include #include #include using namespace std;const int MAX=30005... 阅读全文

posted @ 2015-12-20 00:56 失踪百景 阅读(143) 评论(0) 推荐(0) 编辑

kuangbin_UnionFind A (POJ 2236)

摘要: 挺接近模板的一题 接受O操作的时候扫一遍 符合条件的merge进去 done#include #include #include struct Point{float x,y;};int father[1010];float distance(Point a, Point b){ return... 阅读全文

posted @ 2015-12-20 00:53 失踪百景 阅读(174) 评论(0) 推荐(0) 编辑

kuangbin_ShortPath A (POJ 2387)

摘要: 最短路模板题 但是其实很费时间 因为要看明白dij floyd 以及 dij优化 spfa优化 交了三次 大概是理解了不过涉及到priority_queue的重载运算符问题 以后要在C++里面好好看看 现在不理解Dijkstra ver: 1 #include 2 #include 3 #inc... 阅读全文

posted @ 2015-12-20 00:49 失踪百景 阅读(145) 评论(0) 推荐(0) 编辑