hdu 5256
2015-05-31 20:49
260 查看
卡到 1002 的 krushal 然后就一直没看这道题目
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<vector> #include<cmath> #include<queue> #include<stack> #include<map> #include<set> #include<algorithm> using namespace std; const int maxn=100010; const int INF=1000000100; int a[maxn]; int g[maxn]; int dp[maxn]; int N; int main() { int T,cas=1; scanf("%d",&T); while(T--) { scanf("%d",&N); for(int i=1;i<=N;i++) { scanf("%d",&a[i]); a[i]-=i; } int ans=0; for(int i=0;i<=N;i++)g[i]=INF; for(int i=1;i<=N;i++) { int k=upper_bound(g+1,g+1+N,a[i])-g; g[k]=a[i]; ans=max(ans,k); } printf("Case #%d:\n%d\n",cas++,N-ans); } return 0; }
相关文章推荐
- OC中: Init methods must return a type related to the receiver type
- Qt移植 Window --Linux
- VMware中网络设置之host-only
- Android的ExpandableListView-android学习之旅(二十八)
- Android的ExpandableListView-android学习之旅(二十八)
- Android的ExpandableListView-android学习之旅(二十八)
- 作为DBA如何表达你对女神的爱?
- 第十二周项目一--教师兼干部类
- 开源Asp.net CMS mojoPortal-源码运行
- Oracle相关知识
- ubuntu15.04下安装部署Solr5.1.0(结构介绍)
- Java学习日记值类和对象小结
- 信息院赛-小红灌溉 bfs
- Perl 正则表达式
- java Collection接口和Collections类的层次关系图,类图
- 第十二周上机项目3 时间类
- 设计模式--动态代理(CGLIB)
- 钟表维修管理系统技术解析(二) 登陆验证
- Hive表
- 南阳14 会场安排问题