题目链接 Problem Description Let S = s1 s2 … s2n be a well-formed string of parentheses. S can be encoded in two different ways: By an integer sequence P = p1 p2 … pn where pi is the number of left parentheses before the ith right parenthesis in S (P-seq…
http://acm.hdu.edu.cn/showproblem.php?pid=3410 Passing the Message Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 827 Accepted Submission(s): 546 Problem Description What a sunny day! Let’s…
Problem Description Sample Input 8 I 2 I -1 I 1 Q 3 L D R Q 2 Sample Output 2 3 Hint The following diagram shows the status of sequence after each instruction: 题意:n个操作 5种操作,I x:该光标位置插入x并且光标后移 D :删除光标前的一个数 L :光标左移 R :光标右移 Q k:询问位置k之前的最大前缀和,k不会超过当前…
Function Time Limit: 7000/3500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1866 Accepted Submission(s): 674 Problem Description The shorter, the simpler. With this problem, you should be convinced of this tr…
Get到了全新O(1)替代部分伸展树功能的姿势 左栈stk1维护当前信息,右栈stk2维护历史删除信息 题目求的是严格的前缀和(且小于当前指针)那就每次左栈新增时再更新前缀和信息就好 即使把题面换成最大子段和也是一样搞法 要是O(1)求1到k的最大/小值?再来多一个维护历史的栈..应该可以吧 /*H E A D*/ stack<int> stk1,stk2; ll sum[maxn],maxsum[maxn]; int main(){ int Q,op,x,k; char str[50]; w…
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsum 贪心 HDU 1004 Let the Balloon Rise 字典树,map HDU 1005 Number Sequence 求数列循环节 HDU 1007 Quoit Design 最近点对 HDU 1008 Elevator 模拟 HDU 1010 Tempter of th…
http://acm.hdu.edu.cn/showproblem.php?pid=1022 http://blog.csdn.net/swm8023/article/details/6902426此处分类题 hdu1022题copy代码 #include<iostream> #include<stack> #define max 100 using namespace std; int main() { stack<char>s; int n,i,j,k,result…
HDU 5818 Joint Stacks(联合栈) Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Description 题目描述 A stack is a data structure in which all insertions and deletions of entries are made at one end, called the "top" of…
Rikka with Parenthesis II 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5831 Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Correct parenthe…
HDU 5033 Building(单调栈) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5033 Description Once upon a time Matt went to a small town. The town was so small and narrow that he can regard the town as a pivot. There were some skyscrapers in the town, each l…
Description ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. As a smart ACMer, you want to get ACboy out of the monster's labyrinth.But when you arrive at the g…