
DFS
文章平均质量分 84
jerans
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
qduoj GZS与小公园
GZS与小公园 发布时间: 2015年9月6日 15:18 最后更新: 2016年6月30日 21:57 时间限制: 3000ms 内存限制: 256M 描述 某天GZS漫步在学校新建的小公园,他发现那里建成了一些水池和小河道。我们暂且把它们统一看成水池。假设公园旁有一张小公园的地图,上面仅标识了此处是否是水池,你能帮GZS计算出该地图中一共有几个水池吗。原创 2017-01-07 10:19:55 · 468 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2)C. Ilya And The Tree dfs D - Vitya and Strange Lesson
http://codeforces.com/contest/842/problem/C 树上每个点都有一个权值,求每一个点到根节点路径上所有节点的最大公因子,可以删掉任意一个点,也可以不删 删掉一个点影响的只是这个点的所有孩子节点,所有枚举每个点被删掉的情况,这样复杂度是n^2,加一些剪枝, 1.当到根节点的路径上的最大公因子已经是1,则没必要继续向下搜索了 2.当删掉这个点后得到的gcd原创 2017-08-30 17:56:57 · 304 阅读 · 0 评论 -
2017 Multi-University Training Contest - Team 1 1003(hdu6035Colorful Tree) 树 dfs 1008(6040 Hints)
1003(hdu6035Colorful Tree)题目:http://acm.hdu.edu.cn/showproblem.php?pid=6035. 题意:树上每个点有自己的颜色,树上每条路径的贡献值是这条路径上的点的不同颜色个数,求所有路径的贡献总和 求所有路径上不同颜色的个数和,其实也就是求所有颜色被多少条路径经过,这个并不好求,可以转化为求所有颜色不被哪些路径经过,最后用总路径条数减原创 2017-07-28 21:59:15 · 272 阅读 · 0 评论 -
Educational Codeforces Round 22 C. The Tag Game dfs
C. The Tag Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice got tired of playing the tag game by t原创 2017-06-06 21:10:38 · 430 阅读 · 0 评论 -
ZOJ - 3780 Paint the Grid Againdfs 逆推
Paint the Grid Again Time Limit: 2 Seconds Memory Limit: 65536 KB Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white). Leo has a ma原创 2017-03-20 23:37:24 · 282 阅读 · 0 评论 -
Codeforces Round #403 (Div. 2) C. Andryusha and Colored Balloons dfs(树)
C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andryusha goes through a原创 2017-03-06 21:11:06 · 434 阅读 · 0 评论 -
Tyvj p1336 火车进站 搜索//全排列
背景 话说这是NOI夏or冬令营中的水题...... 做题前明确的是,这题当然 这里有n列火车将要进站再出站…… 但是,每列火车只有1节---那就是车头…… 描述 有n列火车按1到n的顺序从东方左转进站,这个车站是南北方向的,它虽然无限长, 只可惜是一个死胡同,而且站台只有一条轨道, 火车只能倒着从西方出去,而且每列火车必须进站,先进后出。 (某生:不就是个栈吗?原创 2017-03-08 21:44:31 · 499 阅读 · 0 评论 -
Tautology
H - Tautology Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Status Practice POJ 3295 Description WFF 'N PROOF is a logic game played with dice原创 2016-10-10 20:00:29 · 331 阅读 · 0 评论 -
E - Sudoku
E - Sudoku Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Status Description Sudoku is a very simple task. A square table with 9 rows and 9 columns原创 2016-10-18 13:36:25 · 318 阅读 · 0 评论 -
poj 3279 Fliptile
Fliptile Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8690 Accepted: 3255 Description Farmer John knows that an intellectually satisfied cow is a happ原创 2017-01-29 20:37:30 · 237 阅读 · 0 评论 -
poj1426 Find The Multiple
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 29065 Accepted: 12059 Special Judge Description Given a positive integer n, write a原创 2017-01-29 20:28:19 · 245 阅读 · 0 评论 -
Codeforces Round #398 (Div. 2) C. Garland 后序遍历树
C. Garland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Once at New Year Dima had a dream in which he wa原创 2017-02-18 20:36:13 · 524 阅读 · 0 评论 -
CodeForces - 618D Hamiltonian Spanning Tree 思维
题目:点击打开链接题意:n个点的无向完全图,所有边权都是y,给出一个生成树,并把生成树上的n-1条边边权改为x,求这个图的最小边权和的欧拉通路,只输出最小边权和x > y 时应尽量使用生成树上的边,每个点只能经过一次,相当于一个链状结构,问题等于去掉最少的边使得树变成多条链然后就不会了55555看了题解才会,太强了,短短10行代码。。。。。 贪心策略:每个点都尽可能的和子节点构成链状结构,从...原创 2018-03-29 22:45:14 · 244 阅读 · 0 评论