hdu 5290 Bombing plan】的更多相关文章

Bombing plan Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 416    Accepted Submission(s): 96 Problem Description Kingdom Y is in the war with kingdom X. Kingdom X consists of N cities,there…
http://acm.hdu.edu.cn/showproblem.php?pid=5290 题意: 一棵树,每个点有一个权值wi,选择点i即可破坏所有距离点i<=wi的点,问破坏所有点 最少需要选择多少个点 题解:同JLOI2016 侦察守卫 http://www.cnblogs.com/TheRoadToTheGold/p/8544819.html #include<cstdio> #include<cstring> #include<iostream> us…
Bombing Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2650    Accepted Submission(s): 990 Problem Description It’s a cruel war which killed millions of people and ruined series of cities. In o…
The plan of city rebuild Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 616    Accepted Submission(s): 215 Problem Description News comes!~City W will be rebuilt with the expectation to become…
跟 UVa 1474 - Evacuation Plan 一个题,但是在杭电上能交过,在UVa上交不过……不知道哪里有问题…… 将施工队位置和避难所位置排序. dp[i][j] 代表前 i 个避难所收留前 j 个施工队. dp[i][j] = min( dp[i - 1][j - 1], dp[i][j - 1] ) + abs( b[i] - a[j] ); 内存卡的比较死,要用滚动数组,并且记录路径的path[i][j]只能用bool型.MLE了四五次OTL…… #include <cstd…
Backup Plan Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 93    Accepted Submission(s): 36Special Judge Problem Description Makomuno has N servers and M databases. All databases are synchroniz…
题意  一个城市原来有l个村庄 e1条道路  又添加了n个村庄 e2条道路  后来后销毁了m个村庄  与m相连的道路也销毁了  求使全部未销毁村庄相互连通最小花费  不能连通输出what a pity! 还是非常裸的最小生成树  把销毁掉的标记下  然后prim咯  结果是无穷大就是不能连通的 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N =…
vjudge sol 树DP. 首先把模型转换成:每个点可以控制与它距离不超过\(w_i\)的点,先要求选出数量最少的点控制所有点. 设\(f[i][-100...100]\)表示\(i\)号点向上还可以额外控制距离为\(j\)的点的选点最少数量. \(j\)为负则表示\(j\)子树中还有\(-(j+1)\)深度的点没有控制.(比如说,\(j=-1\)说明\(i\)号点还没有被控制,\(j=-2\)说明\(i\)的儿子还没有被控制) 这样一来显然\(j\)越大时的状态是越优的.所以可以对每一层的…
题目HDU 2103:http://acm.hdu.edu.cn/showproblem.php?pid=2103 Problem Description As far as we known,there are so many people in this world,expecially in china.But many people like LJ always insist on that more people more power.And he often says he will…
题目 参考了     1     2 #define _CRT_SECURE_NO_WARNINGS //用的是STL中的map 和 multiset 来做的,代码写起来比较简洁,也比较好容易理解. //multiset可以允许重复 //multiset<int>::iterator it; 用来遍历 #include<stdio.h> #include<string.h> #include<algorithm> #include<iostream&g…