题意很容易转化到这样的问题:在一个强连通的有向图D中是否存在这样的集合划分S + T = D,从S到T集合的边权大于从T到S集合的边权. 即D(i, j)  > B(j, i) + D(j, i).或者等价地对任意集合划分:D(i, j) <= B(j, i) + D(j, i)(*). 实际上若存在可行流f,满足:D(i, j) <= f(i, j) <= B(i, j) + D(i, j),则有对于任意割满足式(*),即可以返回"happy". 关于可行流参…
首先这是一道dp题,对题意的把握和对状态的处理是解题关键. 题目给出的范围是n在1到1e11之间,由于在裂变过称中左儿子总是父亲节点的一个非平凡约数,容易看出裂变过程只与 素数幂有关,并且显然有素数不超过11个,幂指数不超过40,实际上可以用一个大小为11的数组来等价地表示状态,状态 与其内元素顺序无关,因此可以排序,压缩后的状态不超过3000个(准确地说是2957个,通过一个简单的dfs即可统计出此结果). 以上解决了题目的规模问题. 这道题目我开始因为理解错题意wa了几次,不能通过统计儿子节…
Problem Description Tom is a commander, his task is destroying his enemy’s transportation system. Let’s represent his enemy’s transportation system as a simple directed graph G with n nodes and m edges. Each node is a city and each directed edge is a…
思路:无源汇有上下界可行流判定, 原来每条边转化成  下界为D  上界为 D+B   ,判断是否存在可行流即可. 为什么呢?  如果存在可行流  那么说明对于任意的 S 集合流出的肯定等于 流入的, 流出的计算的 X 肯定小于等于这个流量(X是下界之和), 计算出来的Y (上界之和)肯定大于等于 这个流量  肯定满足X<=Y. #include<cstdio> #include<cstring> #include<algorithm> #include<cm…
Turn the pokers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 108    Accepted Submission(s): 21 Problem Description During summer vacation,Alice stay at home for a long time, with nothing to…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4940 Destroy Transportation system Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 21    Accepted Submission(s): 17 Problem Description Tom is a…
Destroy Transportation system Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)http://acm.hdu.edu.cn/showproblem.php?pid=4940 Problem Description Tom is a commander, his task is destroying his enemy’s transportatio…
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…
Description Tom is a commander, his task is destroying his enemy’s transportation system. Let’s represent his enemy’s transportation system as a simple directed graph G with n nodes and m edges. Each node is a city and each directed edge is a directe…
Problem Description Tom is a commander, his task is destroying his enemy’s transportation system. Let’s represent his enemy’s transportation system as a simple directed graph G with n nodes and m edges. Each node is a city and each directed edge is a…