摘要: 链接:https://www.nowcoder.com/acm/contest/91/C来源:牛客网没有账号的同学这样注册,支持博主 题目描述 给定两个长度为n的序列,ai, bi(1<=i<=n), 通过3种魔法使得序列a变换为序列b,也就是ai=bi(1<=i<=n). 魔法1: 交换ai和aj 阅读全文
posted @ 2018-05-31 23:10 咸鱼lzh 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一棵n个节点的树,并且根节点的编号为p,第i个节点有属性值vali, 定义F(i): 在以i为根的子树中,属性值是vali的合约数的节点个数。y 是 x 的合约数是指 y 是合数且 y 是 x 的约数。小埃想知道对1000000007取模后的结果. 输入描述: 输入测试组数T,每组数据 阅读全文
posted @ 2018-05-14 22:23 咸鱼lzh 阅读(276) 评论(0) 推荐(1) 编辑
摘要: E. Short Code time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output E. Short Code time limit pe 阅读全文
posted @ 2018-04-27 23:38 咸鱼lzh 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 4337: BJOI2015 树的同构 Description 树是一种很常见的数据结构。 我们把N个点,N-1条边的连通无向图称为树。 若将某个点作为根,从根开始遍历,则其它的点都有一个前驱,这个树就成为有根树。 对于两个树T1和T2,如果能够把树T1的所有点重新标号,使得树T1和树T2完全相 同 阅读全文
posted @ 2018-04-19 21:59 咸鱼lzh 阅读(190) 评论(0) 推荐(0) 编辑
摘要: B. Destruction of a Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output B. Destruction o 阅读全文
posted @ 2018-04-19 16:38 咸鱼lzh 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 2561: 最小生成树 Description 给定一个边带正权的连通无向图G=(V,E),其中N=|V|,M=|E|,N个点从1到N依次编号,给定三个正整数u,v,和L (u≠v),假设现在加入一条边权为L的边(u,v),那么需要删掉最少多少条边,才能够使得这条边既可能出现在最小生成树上,也可能出 阅读全文
posted @ 2018-03-29 16:23 咸鱼lzh 阅读(213) 评论(0) 推荐(0) 编辑
摘要: F. Machine Learning time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output F. Machine Learning 阅读全文
posted @ 2018-03-20 17:54 咸鱼lzh 阅读(311) 评论(0) 推荐(1) 编辑
摘要: H. Queries for Number of Palindromes time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output H. 阅读全文
posted @ 2018-03-15 16:57 咸鱼lzh 阅读(302) 评论(0) 推荐(0) 编辑
摘要: F. Cutlet time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Arkady wants to have a dinner. 阅读全文
posted @ 2018-03-12 20:19 咸鱼lzh 阅读(422) 评论(0) 推荐(0) 编辑
摘要: B. A Leapfrog in the Array time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output B. A Leapfrog 阅读全文
posted @ 2018-03-09 22:07 咸鱼lzh 阅读(551) 评论(0) 推荐(0) 编辑