摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4027题意:有N条船,每条船都有各自的耐久度.有一种武器能攻击一个范围内的船.还要能计算一定范围内所有船剩余耐久的和. 耐久度去整数.耐久度的和不大于263思路:每次更改都要更新范围内每条船的耐久度. 在攻击一定次数后,剩余耐久度肯定为1 所以结点中所有子节点耐久度均为1,则不需要继续更新 即发现Tree[o].sum == r - l + 1; 则不需要更新其子节点 1 #include <iostream> 2 #include <math.h> 3 using namespace 阅读全文
posted @ 2013-03-25 12:16 zx雄 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1827思路:用Tarjan算法求出各个强连通分支,同一个强连通分支抽象成一点 1 #include <iostream> 2 #include <vector> 3 #include <stack> 4 using namespace std; 5 const int maxn = 1000 + 10; 6 const int maxm = 2000 + 10; 7 struct Node{ 8 int cost; 9 int dfn; 10 int low; 11 ... 阅读全文
posted @ 2013-03-25 11:54 zx雄 阅读(217) 评论(0) 推荐(0) 编辑