HUD 5256 序列变换
来源:互联网 发布:c 程序员职业寿命 编辑:程序博客网 时间:2024/05/16 15:36
这题就是LIS的变形,很好的题
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int maxm=1e5+10;int dp[maxm];int a[maxm];int n;int len;int main(){ int t; int k=1; scanf("%d",&t); while(t--) { scanf("%d",&n); int i; for(i=1; i<=n; i++) { scanf("%d",&a[i]); a[i]-=i; } dp[1]=a[1]; len=1; int j; for(i=2; i<=n; i++) { if(dp[len]<=a[i]) { dp[++len]=a[i]; } else { j=upper_bound(dp+1,dp+len+1,a[i])-dp; dp[j]=a[i]; } } printf("Case #%d:\n",k++); printf("%d\n",n-len); } return 0;}
0 0
- HUD 5256 序列变换
- Hdu 5256 序列变换
- hdu 5256 序列变换
- HDU 5256 序列变换
- HDU 5256 序列变换
- HDOJ 5256 序列变换
- HDU 5256 序列变换
- HDOJ 5256 序列变换
- HDU 5256 序列变换
- HDU ACM 5256 序列变换
- Problem 5256 序列变换 【LIS】
- 【杭电】[5256]序列变换
- 杭电5256序列变换
- HDU-5256 序列变换(LIS)
- 序列变换
- 序列变换
- 序列变换
- 序列变换
- 使用spring data jpa简化dao层编写
- MongoDB常用操作
- hdu5446(2015长春网络赛J题)
- 干一行爱一行
- 更改Eclipse下Tomcat的部署目录
- HUD 5256 序列变换
- DirectX中的颜色表示
- PHP get方式传递参数小心掉坑
- cocos studio2.x 对象绑定
- spring事务管理 事务回滚
- NHibernate从入门到精通系列(3)——第一个NHibernate应用程序
- 用html中div元素画横竖直线的方法
- XMLHttpRequest cannot load"url"Cross origin requests are only supported. send@jquery-2.1.4.js:8630
- Unix编程笔记疑问篇----如何从指令运行的角度去看待系统调用???