题意:给定一个序列,让你构造出一个序列,满足条件,且最大。条件是 选取一个ai <= max{a[b[j], j]-j} 析:贪心,贪心策略就是先尽量产生大的,所以就是对于B序列尽量从头开始,由于数据比较大,采用桶排序,然后维护一个单调队列,使得最头上最大。 代码如下: ...
分类:
其他好文 时间:
2017-07-27 20:30:17
阅读次数:
177
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=6047 题目: Maximum Sequence Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
分类:
其他好文 时间:
2017-07-27 20:12:10
阅读次数:
123
为啥用栈, 数组相对顺序不能变, 要找第一个比当前元素小的元素, 或大的元素, 同84. Largest Rectangle in Histogram 同84. Largest Rectangle in Histogram 在数组后面加"0", 这些操作都是为了遍历所有的元素, 有的不需要遍历所有的 ...
分类:
其他好文 时间:
2017-07-26 23:39:47
阅读次数:
201
解决方案: 方法一:修改php.ini文件 max_execution_time = 30; Maximum execution time of each script, in seconds 把它设置成需要的值就可以了。如果设置成0的话,就是永不过期。 方法二:修改php执行文件 加上 max_e ...
分类:
其他好文 时间:
2017-07-26 15:38:12
阅读次数:
138
Problem Description There is a youngster known for amateur propositions concerning several mathematical hard problems.Nowadays, he is preparing a thou ...
分类:
其他好文 时间:
2017-07-26 10:47:01
阅读次数:
149
Xamarin.Forms使用Slider注意问题 Xamarin.Forms中,Slider用来构建滑块控件。其中,Minimum表示最小值,Maximum表示最大值。如果Minimum大等于1,则需要先设置Maximum,然后再设置Minimum。否则,会报错。 ...
分类:
其他好文 时间:
2017-07-26 10:43:16
阅读次数:
123
一、前人种树 博客:RMQ算法分析 博客:谈谈RMQ算法 博客:RMQ (Range Minimum/Maximum Query)算法 二、沙场练兵 题目:poj 3264 Balanced Lineup ...
分类:
编程语言 时间:
2017-07-26 09:44:01
阅读次数:
204
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another ...
分类:
其他好文 时间:
2017-07-25 22:41:36
阅读次数:
276
static final int DEFAULT_INITIAL_CAPACITY = 16;// 默认初始容量为16,必须为2的幂 static final int MAXIMUM_CAPACITY = 1 << 30;// 最大容量为2的30次方 static final float DEFAU ...
分类:
其他好文 时间:
2017-07-25 22:40:50
阅读次数:
162
代码: class Solution { public: /** * @param prices: Given an integer array * @return: Maximum profit */ int maxProfit(vector<int> &price) { int re = 0; ...
分类:
其他好文 时间:
2017-07-25 19:43:25
阅读次数:
94