![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
文章平均质量分 78
black_miracle
这个作者很懒,什么都没留下…
展开
-
ZJNU 1710 dfs
GEPPETTOTime Limit: 500MS Memory Limit: 65536KDescriptionEveryone’s favorite character and puppet-maker Geppetto has opened a new pizza place, the best in town. Gep原创 2016-04-24 21:33:44 · 457 阅读 · 0 评论 -
codeforces 1101D
传送门:https://codeforces.com/contest/1101/problem/D题意:求一条最长的链,链上所有点的gcd大于1。题解:维护每个点的每个质因子能向下延伸多少。#include<bits/stdc++.h>using namespace std;#define fi first#define se second#define mp m...原创 2019-01-21 14:30:14 · 332 阅读 · 0 评论 -
codeforces 1088E
传送门:https://codeforces.com/contest/1088/problem/E题意:给一棵树,找不超过n个联通块,彼此不相交,且权值总和除以联通块数量最大,如果有多解,要求联通块数量最多。题解:根据平均数可知,答案就是找出来有几个权值和最大的联通块,注意不要彼此覆盖。#include<bits/stdc++.h>using namespace std...原创 2019-01-21 13:57:04 · 151 阅读 · 0 评论 -
codeforces 1062E
传送门:https://codeforces.com/contest/1062/problem/E题意:给你一棵树,每次询问[l,r]区间删掉一个点后,剩余的点的lca深度最大是多少,输出删除的点和lca深度。题解:首先一堆点的lca就是dfs序最大的点和最小的点的lca,那么我们只用考虑删掉这两个点后的lca是多少就可以了,维护区间dfs序最大和次大,最小和次小。#include&...原创 2019-01-24 12:02:51 · 227 阅读 · 0 评论 -
codeforces 1084D
传送门:http://codeforces.com/contest/1084/problem/D题意:给出一棵树,点为正权,边为负权,找出一条简单路径,权和最大。题解:我们定义g[i]代表以i结点为终点,从子树的点上来能获得的最大权值,那么同时要考虑i为转折点,那么只要在子树中找最大和次大的权和即可。#include<bits/stdc++.h>using namesp...原创 2019-01-18 11:22:34 · 205 阅读 · 0 评论 -
gym 100694 C
C. Modern Arttime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputSergey is a modern artist who uses 3D printer in his works. He has just come u...原创 2018-07-27 16:07:20 · 215 阅读 · 0 评论 -
HDU 6035 Colorful Tree
Colorful TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2067 Accepted Submission(s): 881Problem DescriptionThere is a原创 2017-08-01 00:34:45 · 192 阅读 · 0 评论 -
BZOJ 4756 主席树+dfs
Promotion CountingTime Limit: 10 Sec Memory Limit: 128 MB[Submit][Status][Discuss]DescriptionThe cows have once again tried to form a startup company, failing to remember from past experi原创 2017-03-06 15:23:38 · 284 阅读 · 0 评论 -
Codeforces 781A dfs
Andryusha and Colored Balloonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndryusha goes through a par原创 2017-03-06 10:54:37 · 288 阅读 · 0 评论 -
Codeforces 763A dfs+想法
Timofey and a treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEach New Year Timofey and his friends cu原创 2017-02-03 00:49:43 · 410 阅读 · 0 评论 -
Codeforces 767C 树形dp
Garlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce at New Year Dima had a dream in which he was p原创 2017-02-20 14:36:51 · 858 阅读 · 0 评论 -
Codeforces 740D dfs+二分
Alyona and a treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlyona has a tree with n vertices. The ro原创 2016-11-29 16:27:35 · 367 阅读 · 0 评论 -
HDU 5952 搜索
Counting CliquesTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionA clique is a complete graph, in which there is an edge between ever原创 2016-10-30 22:26:30 · 258 阅读 · 0 评论 -
codeforces 1100F
传送门:http://codeforces.com/contest/1099/problem/F题意:两个人在玩游戏。第一个人从根结点出发。每次可以选择往下走一个结点或者结束游戏返回根结点并选择性的吃结点上的饼干。第二个人在第一个人每次向下走之后可以选择一个当前节点的儿子节点ban掉。第一个人一定要在规定时间内返回到根结点,问最多能吃多少块饼干。题解:假设我们在t结...原创 2019-01-16 13:16:38 · 335 阅读 · 0 评论