http://acm.hdu.edu.cn/showproblem.php?pid=4747 题意: 我们定义mex(l,r)表示一个序列a[l]....a[r]中没有出现过得最小的非负整数, 然后我们给出一个长度为n的序列,求他所有的连续的子序列的mex(l,r)的和. 思路: 首先因为n的最大值就是2*10^5 所有我们字需要考虑200000之内的数就好了,然后O(2*n)可以求出(1,1),(1,2), (1,3),(1,4) ... (1,n)来 mex是不减的. 然后我们考虑将第一个数…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 3056    Accepted Submission(s): 1006 Problem Description Mex is a function on a set of integers, which is universally used for impartial game…
参考:http://www.cnblogs.com/oyking/p/3323306.html 相当不错的思路,膜拜之~ 个人理解改日补充. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #define lson l, m, rt << 1 #define rson m + 1, r, rt << 1 | 1 #define l…
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of endurance. For every attack of our secret weapon, it…
题意: 给出一个有n个数的数列,并定义mex(l, r)表示数列中第l个元素到第r个元素中第一个没有出现的最小非负整数. 求出这个数列中所有mex的值. 思路: 可以看出对于一个数列,mex(r, r~l)是一个递增序列 mex(0, 0~n-1)是很好求的,只需要遍历找出第一个没有出现的最小非负整数就好了.这里有一个小技巧: tmp = ; ; i <= n; ++i) { mp[arr[i]] = ; while (mp.find(tmp) != mp.end()) tmp++; mex[i…
题目链接 HDU 1698 Problem Description: In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pudge wants to do some…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21203    Accepted Submission(s): 8750 Problem Description At the entrance to the university, there is a huge rectangular billboard of…
目录 Catalog Solution: (有任何问题欢迎留言或私聊 && 欢迎交流讨论哦 Catalog Problem:Portal传送门  原题目描述在最下面.  1e5个点,问从(0,0)走到(1e9,1e9)的最大收益.  当你从(u-1,v-1)走到(u,v)时,你可以获得点(u,v)的权值. Solution:  十分详细了.  直接线段树区间最值.当然也可以树状数组,不能st表.  \(dp[i] = max(query\_max(0,dp[i]-1,1)+val[i] ,…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 623    Accepted Submission(s): 209 Problem Description Mex is a function on a set of integers, which is universally used for impartial game t…
Color the ball Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7941    Accepted Submission(s): 4070 Problem Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球…