数据结构 并查集
_pkm_
love coding
展开
-
HIHO #1066 : 无间道之并查集
题目链接并查集入门#include<cstdio>#include<algorithm>#include<iostream>#include<cstring>#include<string>#include<cmath>#include<queue>#include<map>#include<set>#include<cstdlib>#include<vector>using原创 2016-08-09 18:15:40 · 298 阅读 · 0 评论 -
Codeforces Round #286 (Div. 1) D. Mr. Kitayuta's Colorful Graph (并查集 STL)
题意链接 题意:给出一个图,告诉每个点之间的边的颜色(有重边),问你任意两点之间有多少边连接。 解法:并查集处理,f[x][c]:表示与x 链接且颜色是c的顶点y AAA:姿势不对 会超时,正确的姿势是unordered_map,其暴力遍历的时候要循环小的#include<bits/stdc++.h>using namespace std;#define LL long long#de原创 2015-11-18 18:40:55 · 417 阅读 · 0 评论 -
HDU1811 Rank of Tetris(并查集+拓扑排序)
思路:利用并查集缩点,把相等的点看成一个,然后他们的父亲的号,就相当于他们的新号#include<cstdio>#include<iostream>#include<algorithm>#include<cmath>#include<set>#include<map>#include<string>#include<cstring>#include<stack>#include<原创 2015-09-02 16:18:32 · 443 阅读 · 0 评论 -
1021. Deepest Root (25) 并查集&&DFS
1021. Deepest Root (25)时间限制1500 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA graph which is connected and acyclic can be considered a tree. The height of the tree depend原创 2015-03-13 21:05:42 · 1274 阅读 · 0 评论 -
POJ 1308 Is It A Tree? 并查集
Is It A Tree?Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 1308DescriptionA tree is a well-known data structure that is either emp原创 2015-03-12 15:19:29 · 916 阅读 · 0 评论 -
04-2. File Transfer (25)并查集
04-2. File Transfer (25)时间限制150 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, YueWe have a network of computers and a list of原创 2014-12-29 20:35:17 · 1059 阅读 · 0 评论 -
杭电1272 并查集
小希的迷宫Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 27063 Accepted Submission(s): 8353Problem Description上次Gardon的迷宫城堡小希玩了很久原创 2014-09-27 20:09:24 · 485 阅读 · 0 评论