树
文章平均质量分 83
清风--旋叶
eline
展开
-
BST二叉搜索树的建树和先序遍历
http://acm.hdu.edu.cn/showproblem.php?pid=3999原创 2014-06-17 10:39:37 · 1553 阅读 · 0 评论 -
poj 3398 Perfect Service(最小支配集树形DP)
题目链接:http://poj.org/problem?id=3398原创 2014-09-02 14:15:58 · 774 阅读 · 0 评论 -
poj 1789 Truck History(Prim)
#include#include#define INF 0xffffffint map[2001][2001],vis[2001],dist[2001];int n;typedef struct{ char str[20];}Node;Node node[2001];int Dist(Node a,Node b){ int i,j,cnt=0; for(原创 2014-08-19 14:34:41 · 528 阅读 · 0 评论 -
poj 1470 Closest Common Ancestors(LCA)
题目链接:http://poj.org/problem?id=1470DescriptionWrite a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common原创 2014-08-26 12:09:52 · 595 阅读 · 0 评论 -
poj 1330 Nearest Common Ancestors(LCA模板)
题目链接:http://poj.org/problem?id=1330原创 2014-08-26 09:03:54 · 593 阅读 · 0 评论 -
hdu 2874 Connections between cities(LCA)
#include#includeconst int maxn=20010;struct node{ int from; int to; int lca; int next;}edge[maxn],qedge[maxn*100];int head[maxn],qhead[maxn];int vis[maxn],dist[maxn];int p[maxn原创 2014-08-25 13:01:58 · 603 阅读 · 0 评论 -
hdu 2586 How far away ?(LCA)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586Problem DescriptionThere are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like th原创 2014-08-25 12:54:28 · 651 阅读 · 0 评论 -
Kruskal基础最小生成树
http://acm.hdu.edu.cn/showproblem.php?pid=1863#include#include#includeusing namespace std;int f[105];typedef struct{ int x,y,w;}Edge;Edge edge[5000];int find(int x){ if(f[x]!=x)原创 2014-03-05 09:08:51 · 981 阅读 · 0 评论 -
pojn 1861 Network(Kruskal)
题目链接:http://poj.org/problem?id=1861DescriptionAndrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the company, they can原创 2014-08-19 14:28:37 · 2484 阅读 · 0 评论 -
poj 1463 Strategic game(最小点覆盖树形DP)
题目链接:http://poj.org/problem?id=1463原创 2014-09-02 15:53:45 · 657 阅读 · 0 评论