随笔分类 -  拓扑

D. Numbers on Tree
摘要:http://codeforces.com/contest/1287/problem/D 思路: 1. 每个子树维护一个数组,包含所有节点的编号和值,且按值排序。 2. 每个子子树的数组需要合并到父节点表示的父子树中,合并需要维护按照值的递增顺序。 3. 所有子子树合并到当前节点表示的父子树中后需要 阅读全文
posted @ 2020-01-07 15:44 夜-> 阅读(389) 评论(0) 推荐(0)
D. Good Sequences
摘要:http://codeforces.com/contest/265/problem/D好题呀先按照求素数的方法 再求的过程中 把所给数组中具有相同素数约数的最邻近的两个数 进行建边 然后进行拓扑代码及其注释:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#incl 阅读全文
posted @ 2013-01-21 15:31 夜-> 阅读(143) 评论(0) 推荐(0)