这个题目虽然在比赛的时候苦思无果,但是赛后再做就真的是个水题,赤果果的水题. 题目的意思是给n个数构成的环,两只兔子从任一点开始分别顺逆时针跳,每次可以调到任意一个数(最多不会跳过一圈). 求最多能跳多少步. 这个题目是个dp,两个不同的方向开始跳跃,而且跳过的数字相同,那么就是要你求回文子串啦, 可以这样考虑,用dp的方法求出从一个位置到另一个位置的最长回文子串的长度,这样等于把[1-n]个数分成两个区间[1-x]和[x+1,n], 而答案就是两个区间最长回文串之和.(仔细理解这里,这是关键)…
Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny afternoon, they planned to play a game with some stones. There were n stones on the ground and they were arranged as a clockwise ring. That is to say, the firs…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4747 思路: 比赛打得太菜了,不想写....线段树莽一下 实现代码: #include<iostream> #include<cstdio> #include<map> #include<cmath> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|…
题意: + ;];;;], seg[rt <<  | ]);)) * fa.setv;) * fa.setv;;], seg[rt <<  | ], r - l + );;, R, rson);;) * v;;], seg[rt <<  | ], r - l + );, R, v, rson);], seg[rt <<  | ]);], seg[rt <<  | ], r - l + );, R, v, rson);], seg[rt <&…
Zhuge Liang's Mines Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 44    Accepted Submission(s): 9 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous and…
啦啦啦. 这是杭州网赛的一个题目,当时没做出来,当然这个想法确实比较难想到. 题目质量很高,这个题目也很特别,以前都没做过类似的题目.让我又一次体验了线段树的强大力量. 题目的意思是给你n个数a1-an.对于任何一个区间[l,r],它所对应的值为这个区间内没有出现的最小非负整数,求所有1<=L<=R<=n的区间所对应的值的总和. 比赛的时候苦思无果,以为是什么高端的数据结构或者很奇怪的算法,后来才发现自己坑了. 题目其实是这样的,在最开始预处理所有1开头的(即L=1的所有区间的值,然后从…
Description At the end of the 200013 th year of the Galaxy era, the war between Carbon-based lives and Silicon civilization finally comes to its end with the Civil Union born from the ruins. The shadow fades away, and the new-born Union is opening a…
Problem Description Mex is a function on a set of integers, which is universally used for impartial game theorem. For a non-negative integer set S, mex(S) is defined as the least non-negative integer which is not appeared in S. Now our problem is abo…
http://acm.hdu.edu.cn/showproblem.php?pid=4710 Balls Rearrangement Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 735    Accepted Submission(s): 305 Problem Description Bob has N balls and A b…
http://acm.hdu.edu.cn/showproblem.php?pid=4708 Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Alice was felling into a cave. She found a strange door with a number square m…