题意: + ;];;;], 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 <&…
题目链接: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|…
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…
AC了,但是不知道为什么,但是恶心的不得了~最近写代码,思路都非常清晰,但是代码各种bug~T.T~说说思路吧:二分~330ms~ 小队友fribbi的思路是离线250msAC~ 预处理solve函数(让能求出来的尽量都求出来)-->a[2]和a[n-3]已知 ①已知a[i]可知a[i+3]②已知a[i] a[i-1] 或者a[i] a[i+1]或者a[i+1] a[i-1]可知全部 ③已知a[0]或a[1]或a[n-2]或a[n-1]可知全部 提问: ①已知则直接输出,不存在a[i+1] a[…
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个数构成的环,两只兔子从任一点开始分别顺逆时针跳,每次可以调到任意一个数(最多不会跳过一圈). 求最多能跳多少步. 这个题目是个dp,两个不同的方向开始跳跃,而且跳过的数字相同,那么就是要你求回文子串啦, 可以这样考虑,用dp的方法求出从一个位置到另一个位置的最长回文子串的长度,这样等于把[1-n]个数分成两个区间[1-x]和[x+1,n], 而答案就是两个区间最长回文串之和.(仔细理解这里,这是关键)…
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…
原题戳这里. 题意: 有一未知列数a1,a2,a3.....an, 已知s[i]=a[i-1]+a[i]+a[i]  (1<i<n) s[1]=a[1]+a[2]; s[n]=a[n-1]+a[n] 还知道a数列中一些数的值(可以全部不知道) 询问一些数 可能的最大值是多少. 首先,可以根据s数组求出a[i]的值(i为3 的倍数) answer[3k]=s[3k-1]-s[3k-2]+a[3k-3]; 其次,要是知道连续两个数a[i] ,a[i+1],或者a[i],a[i+1],那么就能确定整…
啦啦啦. 这是杭州网赛的一个题目,当时没做出来,当然这个想法确实比较难想到. 题目质量很高,这个题目也很特别,以前都没做过类似的题目.让我又一次体验了线段树的强大力量. 题目的意思是给你n个数a1-an.对于任何一个区间[l,r],它所对应的值为这个区间内没有出现的最小非负整数,求所有1<=L<=R<=n的区间所对应的值的总和. 比赛的时候苦思无果,以为是什么高端的数据结构或者很奇怪的算法,后来才发现自己坑了. 题目其实是这样的,在最开始预处理所有1开头的(即L=1的所有区间的值,然后从…
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…