
数据结构--单调队列与栈
至此曾经
从未坚持?
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
图灵杯 爬楼梯
题目描述 由于第m个台阶上有好吃的薯条,所以薯片现在要爬一段m阶的楼梯. 薯片每步最多能爬k个阶梯,但是每到了第i个台阶,薯片身上的糖果都会掉落ai个,现在问你薯片至少得掉多少糖果才能得到薯条? 输入 多组数据输入,每组数据第一行输入两个数字m(1 输出 对于每组数据,输出至少要牺牲的糖果数. 样例输入 5 2 1 2 3 4 5 6 2 6 5 4 3 2原创 2016-11-19 16:11:49 · 875 阅读 · 0 评论 -
poj 2823 Sliding Window
Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the wi原创 2016-11-04 20:21:15 · 274 阅读 · 0 评论 -
hdu 5289 Assignment
Problem Description Tom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this company, and every staff has a ability. Now, Tom is going to assign a special task原创 2017-09-21 17:34:53 · 225 阅读 · 0 评论 -
2018 Multi-University Training Contest 1 RMQ Similar Sequence
题意:序列A, 定义RMQ(A,l,r) 为A序列 l到r中最大值的最小位置i,RMQ相似为 对于A,B两个序列, 使得任意l ,r , RMQ(A,l,r)= RMQ(B,l,r)现在B序列元素的值均在[0,1]随机。如果B与A RMQ相似, 则B的重量为B元素的和,否则为0。求B的期望重量。 题解: 笛卡尔树性质 树中的元素满足二叉搜索树性质,要求按照中序遍历得到的序列为原数组序列 ...原创 2018-07-31 16:02:55 · 184 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛 G. Trace
题目:https://nanti.jisuanke.com/t/31459 解法:很多解法吧,分享一个巧妙的解法,按x排序后,用单调栈: /* 最后的图肯定是 下降的 梯子形状 而且没有一个块 会被完全挡住 所以 一个块在x方向上 挡住它的 只有x小于它 的块 所以 保证此解法的正确性 */ #include<iostream> #include<algorithm>...原创 2018-09-10 18:59:32 · 188 阅读 · 0 评论