树
文章平均质量分 82
丶先森
这个作者很懒,什么都没留下…
展开
-
POJ1985Cow Marathon(求树的直径模板)
Cow MarathonTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 5253 Accepted: 2574Case Time Limit: 1000MSDescriptionAfter heari原创 2017-03-02 23:49:05 · 225 阅读 · 0 评论 -
The Unique MST POJ - 1679 (次小生成树模板)
The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32148 Accepted: 11633DescriptionGiven a connected undirected graph, tell if its minimum sp原创 2017-09-21 21:45:37 · 223 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2) C. Ilya And The Tree(dfs+最大公约数+因子+树)
C. Ilya And The Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIlya is very fond of graphs, especiall原创 2017-08-30 12:27:04 · 815 阅读 · 0 评论 -
Roads in the North POJ - 2631(树的直径)
Roads in the NorthTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2992 Accepted: 1477DescriptionBuilding and maintaining roads among communities in the原创 2017-09-15 21:10:40 · 226 阅读 · 0 评论 -
HDU - 2665 Kth number(划分树模板题)
Kth numberTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12101 Accepted Submission(s): 3692Problem DescriptionGive you a sequen原创 2017-08-20 18:15:06 · 221 阅读 · 0 评论 -
AtCoder Beginner Contest 067 D - Fennec VS. Snuke(树上DFS,博弈)
D - Fennec VS. SnukeTime limit : 2sec / Memory limit : 256MBScore : 400 pointsProblem StatementFennec and Snuke are playing a board game.On the board, there are N cells numbered原创 2017-07-28 15:39:08 · 379 阅读 · 0 评论 -
2010-2011 ACM-ICPC, NEERC, Southern Subregional Contest Fire in the Country(博弈论+搜索)
D. Fire in the Countrytime limit per test1.0 smemory limit per test256 MBinputinput.txtoutputoutput.txtThis summer's heat wave and drought unleashed devastating原创 2017-08-11 16:58:57 · 528 阅读 · 0 评论 -
Codeforces Round #168 (Div. 1) B. Zero Tree(树上DFS)
B. Zero Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA tree is a graph with n vertices and exactly原创 2017-08-03 21:42:43 · 286 阅读 · 0 评论 -
2015-2016 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2015) Adjoin the Networks (树的直径)
、题目大意:有n个点m条边,现在希望将所有的点连接在一起,且要求生成的树的直径尽可能小,问树的直径最小的最大值多少解题思路:对于目前每个独立的树,求出其的直径,对直径进行排序,为了让最后的树的直径尽可能的小,能做的就是每次将每个树的直径的一半都连接起来,于是最后的答案就从三种情况下出现,第一个情况就是最长的那个树的直径就是最后答案,第二个情况就是最长的直径的一半加次长的直径的一半+1,第三原创 2017-08-02 16:53:34 · 451 阅读 · 0 评论 -
2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛(湖南) 暨 第九届湘潭市大学生程序设计比赛H.Highway(树的直径)
HighwayAccepted : 122 Submit : 393Time Limit : 4000 MS Memory Limit : 65536 KBHighwayIn ICPCCamp there were n towns conveniently numbered with 1,2,…,n c原创 2017-05-18 21:13:40 · 1372 阅读 · 0 评论 -
AtCoder Grand Contest 015 C.Nuske vs Phantom Thnook
C - Nuske vs Phantom ThnookTime limit : 4sec / Memory limit : 256MBScore : 700 pointsProblem StatementNuske has a grid with N rows and M columns of squares. The rows are numbered 1原创 2017-05-28 17:14:26 · 474 阅读 · 0 评论 -
CS Academy E.Triplet Min Sum(最近公共祖先 倍增法模板)
Triplet Min SumTime limit: 2500 msMemory limit: 128 MBYou are given a tree with NN nodes. Answer QQ queries of the type:Given three distinct nodes AA, BB, and CC, find the原创 2017-05-26 21:09:13 · 287 阅读 · 0 评论 -
数据结构二叉树——前中后序深度子节点个数
#include#include#include#include#includeusing namespace std;struct point{ string str; int lson, rson;}p[1000005];vector aa[1000005];int sum;int ans;void create(int x,int y){ string st原创 2017-05-03 22:52:05 · 220 阅读 · 0 评论 -
POJ3268 Silver Cow Party(最短路问题)
Silver Cow PartyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 21730 Accepted: 9923DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently原创 2017-05-03 22:02:22 · 235 阅读 · 0 评论 -
POJ2395Out of Hay(最小生成树Kruskal模板)
Out of HayTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16495 Accepted: 6460DescriptionThe cows have run out of hay, a horrible event that must be rem原创 2017-04-14 21:06:12 · 259 阅读 · 0 评论 -
E. Anton and Tree(缩点+树直径模板)
E. Anton and Treetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton is growing a tree in his garden. In原创 2017-03-01 23:58:59 · 496 阅读 · 0 评论 -
HDU - 3966 Aragorn's Story(树链剖分点权模板题)
Aragorn's StoryTime Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13639 Accepted Submission(s): 3632Problem DescriptionOur protagon原创 2017-10-12 21:01:59 · 241 阅读 · 0 评论