2015 多校赛 第七场 1011 (hdu 5379)】的更多相关文章

题意:给定一棵树,树上有 n 个节点.问有多少种方案,使得在每个节点上依次放置数 1~n 后,每个节点的儿子节点上的数连续(比如 1 为根,有1-2,1-3,1-4,则令2,3,4上的数连续),每个子树上的数连续. 注释在代码里. #pragma comment(linker, "/STACK:102400000,102400000") #include<iostream> #include<cstdio> #include<algorithm> #…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5352 看题看得心好累. 题目大意: 给出 n 个点,依次执行 m 次操作:输入“1 x”时,表示将与 x 连通的点全部修复:输入“2 x y”,表示在 x 与 y 之间加一条边:输入“3 x y”,表示删除 x 与 y 之间的边.题目确保不会与重边并且操作合法. 题目会给出 k,要求每次修复的的点的数目小于等于k. 问:怎样执行操作1,使得令修复点数最多的同时,令每次执行操作1所修复的点的数目所构成…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5348 题目大意:给出一幅无向图,问是否存在一种方案,使得给每条边赋予方向后,每个点的入度与出度之差小于等于1.如不存在,输出-1:存在,则按边的输入顺序输出方向. 比如:若给出第 m 条边为 u,v,则在对应第m行输出0表示u->v,输出1表示u<-v. 解题思路: 首先证明一定可以构造出符合要求的图. 对于一个环,显然可以使得其内的每个点入度与出度相等.之后可以把环看成点. 对于一棵树,则可以通…
Problem Description XYZ is playing an interesting game called "drops". It is played on a r∗c grid. Each grid cell is either empty, or occupied by a waterdrop. Each waterdrop has a property "size". The waterdrop cracks when its size is…
Problem Description In an n∗m maze, the right-bottom corner is the exit (position (n,m) is the exit). In every position of this maze, there is either a 0 or a 1 written on it. An explorer gets lost in this grid. His position now is (1,1), and he want…
Description Mr. Hdu is interested in Greatest Common Divisor (GCD). He wants to find more and more interesting things about GCD. Today He comes up with Range Greatest Common Divisor Query (RGCDQ). What’s RGCDQ? Please let me explain it to you gradual…
pid=5379">http://acm.hdu.edu.cn/showproblem.php? pid=5379 Problem Description Little sun is an artist. Today he is playing mahjong alone. He suddenly feels that the tree in the yard doesn't look good. So he wants to decorate the tree.(The tree has…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5373 The shortest problem Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 995    Accepted Submission(s): 498 Problem Description In this problem, w…
链接:https://www.nowcoder.com/acm/contest/145/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K Special Judge, 64bit IO Format: %lld 题目描述 You have a n * m grid of characters, where each character is an English letter (lowercase or uppercase, w…
链接:https://www.nowcoder.com/acm/contest/145/C 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 A binary string s of length N = 2n is given. You will perform the following operation n times : - Choos…