题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3765 Lights Time Limit: 8 Seconds Memory Limit: 131072 KB Now you have N lights in a line. Don't worry - the lights don't have color. The only status they have is on and off. And,…
题目链接:http://poj.org/problem?id=3580 Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, {A1, A2, ... An}. Then the h…
hdu 2871 Memory Control 题意:就是对一个区间的四种操作,NEW x,占据最左边的连续的x个单元,Free x 把x单元所占的连续区间清空 , Get x 把第x次占据的区间输出来, R 清空整个区间. 解题思路:这个题就是一个区间合并,以前用线段树写的,拿来练练splay.要记录的是区间最大的连续空格,要维护这个最值,需要两个辅助的值,该区间左边连续的最值和右边连续的最值.更新的时候仔细就好了,其他就是splay的常规操作的.还有就是记录占据的连续区间和查找占据的连续区间…
Looploop Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 781 Accepted Submission(s): 220 Problem Description XXX gets a new toy named Looploop. The toy has N elements arranged in a loop, an a…
前言 这篇博客是根据我在打这道题的时候遇到的问题,来打的,有些细节可能考虑不到. 题目 在N(1<=N<=100000)个数A1-An组成的序列上进行M(1<=M<=100000)次操作,操作有两种: (1)1 L R C:表示把A[L]到A[R]增加C(C的绝对值不超过10000): (2)2 L R:询问A[L]到A[R]之间的最大值. 分析 由于本人刚刚学会splay,不够精通,splay的打法这里就先不说. 就讲讲求区间极值的方法吧. 对于每个位置开一个节点,记录这个节点的…