08 2013 档案

摘要:uva 10891Game of Sum题目大意:两个人轮流从数组里面取数,可以在头或者尾选择连续的任意多个,直到取完。最后统计两个人取走的数之和,两个人都尽量让自己的得分高,求A的得分减去B的得分。分析:这题的关键是只能在头尾取,把数组看成一个序列(i~j),那么取走k个数后仍是一个连续的序列(i+k,j)或(i,j-k)。我们用dp[i][j]表示碰到(i,j)这个序列能得到的最高分数。那么我们考虑如何转移,这里有点博弈的思想,我们要现在这个状态最高即要求对方碰到的状态(即自己取完后的状态)的得分越少越好。那么状态转移方程就是dp[i][j]=sum[i][j]-min{dp[i+1][j 阅读全文
posted @ 2013-08-28 11:13 默默如潮 阅读(519) 评论(0) 推荐(0)
摘要:hdu 1829A Bug's Lifehttp://acm.hdu.edu.cn/showproblem.php?pid=1829解题思路:这个题目跟其他的不太一样,给出的不是同类而是异类,其实是差不多的。增加一个sex[i]表示i的异类,那么就是有两个集合,输入一组数据的时候判断一下两个是不是在同一个集合里,如果是那么输出Suspicious bugs found!一直没有输出No suspicious bugs found! 1 #include 2 #include 3 #include 4 #define maxlen 2010 5 using namespace std; 阅读全文
posted @ 2013-08-12 20:11 默默如潮 阅读(217) 评论(0) 推荐(0)
摘要:线段树的风格是跟NotOnlySuccess学的单点更新:最最基础的线段树,只更新叶子节点,然后把信息用PushUP(int r)这个函数更新上来1、hdu1166 敌兵布阵C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇 阅读全文
posted @ 2013-08-12 14:02 默默如潮 阅读(423) 评论(0) 推荐(0)
摘要:Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us.There is a large number of magnetic plates on every door. Every plat 阅读全文
posted @ 2013-08-11 19:50 默默如潮 阅读(253) 评论(0) 推荐(0)
摘要:并查集是一种很方便实现也很有效的数据结构,应用也十分的广泛,主要包括两个操作,合并与查询,当然还有很多的变形。一、先来很裸的并查集:uva1160 - X-PlosivesX-PlosivesA secret service developed a new kind of explosive that attain its volatile property only when a specific association of products occurs. Each product is a mix of two different simple compounds, to which 阅读全文
posted @ 2013-08-11 10:37 默默如潮 阅读(449) 评论(0) 推荐(0)
摘要:A company offers personal computers for sale in N towns (3 2 #include 3 #include 4 #include 5 #define maxlen 40 6 using namespace std; 7 int maps[maxlen][maxlen]; 8 int s[maxlen]; 9 int visited[maxlen];10 int ans;11 int n,m;12 bool cmp(int a,int b)13 {14 return a>b;15 }16 void dfs(int v,int ... 阅读全文
posted @ 2013-08-08 11:33 默默如潮 阅读(612) 评论(0) 推荐(0)
摘要:Oil DepositsThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then analyzes each plot separately, using sensing. 阅读全文
posted @ 2013-08-01 20:52 默默如潮 阅读(355) 评论(1) 推荐(0)