51nod 1272 最大距离(贪心)
来源:互联网 发布:2016广告主投放数据 编辑:程序博客网 时间:2024/05/22 08:28
没想到。。。。
参考:http://blog.csdn.net/qq_21057881/article/details/52739386
#include <iostream>#include <algorithm>using namespace std;const int MAXN = 5e4+10;int num[MAXN];int index[MAXN];int main(){ int n; cin >> n; for(int i = 0; i < n; ++i) { cin >> num[i]; index[i] = i; } stable_sort(index,index+n,[](int a, int b)->bool {return num[a] < num[b];}); int mark = 5e4+10; int res = 0; for(int i = 0; i < n; ++i) { if(index[i] > mark) res = max(res,index[i]-mark); else mark = index[i]; } cout << res << endl; return 0;}
阅读全文
0 0
- 51nod 1272 最大距离(贪心)
- 51nod 1272 最大距离(贪心)
- 51nod oj 1272 最大距离【贪心】
- 51nod 1272 最大距离 (贪心或单调栈)
- 51nod 1272 最大距离(思维)
- 51NOD 1272 最大距离
- 51nod 1272 最大距离
- 51Nod 1272 最大距离
- 51nod 1272 最大距离
- 51nod 1272 最大距离
- 51NOD 1272 最大距离(线段树)
- 51nod 1272 最大距离 (单调栈)
- 51Nod-1272-最大距离
- 51nod 1272 最大距离 By Assassin
- 51nod 1272 最大距离【思维】
- 51nod 1272 最大距离 思维题
- 51 nod 1272 最大距离(树状数组)
- 51nod 1272 最大距离 -暴力
- 2017.06.19 学习总结
- Couchbase Client Python
- 网页启动App&网页跳转到App指定的页面
- 日常训练 20170619 被删除量子化粉碎未出生的回文矩阵
- 对H264进行RTP封包原理
- 51nod 1272 最大距离(贪心)
- Day02
- 自定义NSLayoutConstraint约束库
- 使用ajax提交form表单,包括ajax文件上传
- ContentValues
- calendar相关
- 关于chrome控制台警告:Synchronous XMLHttpRequest on the main thread终极解决办法
- Find Largest Value in Each Tree Row
- RDD、DataFrame和DataSet三者的关系