摘要: class UnionFindSet { private: int *pref; int *rank; int capacity; public: UnionFindSet(int n) { if (n = c... 阅读全文
posted @ 2014-04-15 21:26 卖程序的小歪 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;typedef pair P;int main() { // zero means no connection int graph[5][5] = { ... 阅读全文
posted @ 2014-04-15 19:49 卖程序的小歪 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 单源最短路径算法Bellman-ford练习,可以处理有负边的情况(也可以在存在负圈时及时终止)#include #include #include using namespace std;class Edge {public: int from; int to; int cost... 阅读全文
posted @ 2014-04-15 19:45 卖程序的小歪 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;class BinaryIndexedTree {private: int *mem; int capacity;public: BinaryIndexedTree (int n) { if ... 阅读全文
posted @ 2014-04-15 16:11 卖程序的小歪 阅读(143) 评论(0) 推荐(0) 编辑