摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1558先判断线段相交,然后用并查集合并。 1 #include 2 #include 3 #include 4 #define maxn 20000 5 using namespace std; 6 7 i... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1272 1 #include 2 #include 3 #include 4 #define maxn 50000 5 using namespace std; 6 7 int in[maxn... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1325 1 #include 2 #include 3 #include 4 #define maxn 5000 5 using namespace std; 6 7 int in[maxn]... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1213 1 #include 2 #include 3 #include 4 #define maxn 2000 5 using namespace std; 6 7 int f[maxn],n,m; 8 ... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3047带权并差集 1 #include 2 #include 3 #include 4 #define maxn 60000 5 using namespace std; 6 7 int f[maxn],d... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3635 1 #include 2 #include 3 #include 4 #define maxn 20000 5 using namespace std; 6 7 int f[maxn]; 8 int... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1856这道题就是求一个集合里面最大的个数。 基本的并查集加一个步骤,将合并后的元素的个数保存在新的树根中。 1 #include 2 #include 3 #include 4 #define maxn 10... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1690 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 500 7 #define LL __int64 8 u... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3191这道题求次短路经和路径数 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 2000 7 us... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1688这道题就是求最短路路径和次短路路径的条数。用一个二维数组记录每一个节点距离起始点的最短距离和次短距离,再开一个二维数组记录路径数更新状态时:1)新值小于最短路径长:更新最短路径长,计数;次短路径长,计数2)新... 阅读全文