随笔分类 - 拓扑
D. Numbers on Tree
摘要:http://codeforces.com/contest/1287/problem/D 思路: 1. 每个子树维护一个数组,包含所有节点的编号和值,且按值排序。 2. 每个子子树的数组需要合并到父节点表示的父子树中,合并需要维护按照值的递增顺序。 3. 所有子子树合并到当前节点表示的父子树中后需要
阅读全文
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
阅读全文
浙公网安备 33010602011771号