Mart Master II Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 675    Accepted Submission(s): 237 Problem Description Trader Dogy lives in city S, which consists of n districts. There are n - 1…
Clone Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/65536K (Java/Other) Total Submission(s) : 8   Accepted Submission(s) : 5 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description After eating food from Chernobyl,…
Description Edward is a rich man. He owns a large factory for health drink production. As a matter of course, there is a large warehouse in the factory. To ensure the safety of drinks, Edward hired a security man to patrol the warehouse. The warehous…
题意:       这个是The 2014 ACM-ICPC Asia Mudanjiang Regional First Round 的C题,这个题目当时自己想的很复杂,想的是优先队列广搜,然后再在前向星里排序,结果写了好长,然后wa掉了,还好后来被队友A了,题意是给你一个无向图,然后让你遍历所有的点,但是有一些点的之间的遍历顺序有限制,最后问你能否遍历所有点. 思路:        今早起来才用自己的思路A了这个题,其实我们可以按照限制的顺序,一个一个枚举,对于当前的这个点,我们从它开始搜,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5029 Problem Description The soil is cracking up because of the drought and the rabbit kingdom is facing a serious famine. The RRC(Rabbit Red Cross) organizes the distribution of relief grain in the disa…
Tree http://acm.hdu.edu.cn/showproblem.php?pid=5044 树链剖分,区间更新的时候要用on的左++右--的标记方法,要手动扩栈,用c++交,综合以上的条件可过. #include<cstdio> #include<cstring> #include<algorithm> #pragma comment(linker, "/STACK:36777216") #define mt(a,b) memset(a,…
Wang Xifeng's Little Plot http://acm.hdu.edu.cn/showproblem.php?pid=5024 预处理出每个点八个方向能走的最远距离,然后枚举起点,枚举方向,每走一步都要枚举左转和右转的情况,因为预处理好了,所以可以直接算出来. #include<cstdio> #include<algorithm> using namespace std; ; char a[M][M]; ]; ,-,,,,,,-}; ,,,,,-,-,-}; b…
默默的签到 Osu! http://acm.hdu.edu.cn/showproblem.php?pid=5003 #include<cstdio> #include<algorithm> using namespace std; ]; int main(){ int t,n; while(~scanf("%d",&t)){ while(t--){ scanf("%d",&n); ;i<n;i++){ scanf(&qu…
G - Grade Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it’s grade s is s = 10000 - (100 - w)^2What…
03 hdu5009 状态转移方程很好想,dp[i] = min(dp[j]+o[j~i]^2,dp[i]) ,o[j~i]表示从j到i颜色的种数. 普通的O(n*n)是会超时的,可以想到o[]最大为sqrt(n),问题是怎么快速找到从i开始往前2种颜色.三种.四种...o[]种的位置. 离散化之后,可以边走边记录某个数最后一个出现的位置,初始为-1,而所要求的位置就等于 if(last[a[i]]==-1) 该数没有出现过,num[i][1] = i,num[i][j+1] = num[i-1…