hdu 1257 最少拦截系统(DP)
来源:互联网 发布:知乎在国外开中餐厅 编辑:程序博客网 时间:2024/05/22 17:24
题目链接:hdu1257
转化为单调递增最长子序列问题
#include <iostream>#include <queue>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <cstdlib>#include <string>#include <map>using namespace std;const int inf = 0x3f3f3f3f;const int N = 5005;int d[N];int a[N];int main(){ int T,n,i,j;while(~scanf("%d",&n)){for(i = 0; i < n; i ++)scanf("%d",&a[i]);int top = 0;d[0] = -inf;for(i = 0; i < n; i ++){if(a[i] > d[top]){d[++top] = a[i];continue;}int pos = lower_bound(d, d+top+1, a[i]) - d;d[pos] = a[i];}printf("%d\n",top);} return 0;}
- hdu 1257 最少拦截系统 (DP)
- hdu 1257 最少拦截系统(DP)
- HDU 1257 最少拦截系统(dp)
- hdu 1257 最少拦截系统(dp)
- hdu 1257 最少拦截系统(DP + 贪心)
- hdu 1257 最少拦截系统(dp)
- HDU 1257 最少拦截系统 DP
- hdu 1257 最少拦截系统(贪心,dp)
- hdu 1257 最少拦截系统 dp
- hdu 1257 最少拦截系统 dp
- hdu 1257 最少拦截系统(dp)
- DP-HDU-1257-最少拦截系统
- HDU 1257 最少拦截系统(DP)
- HDU 1257 最少拦截系统【贪心】【DP】
- hdu 1257 最少拦截系统(DP)
- HDU 1257 最少拦截系统 DP -
- HDU 1257 最少拦截系统【dp】
- 【HDU 1257 最少拦截系统】+ dp
- Python学习(六)------- 序列类型
- 百度地图API实现定位与目的地导航
- 一个c语言题目
- linux系统时间修改及同步
- 浅谈Java线程启动与Thread.join()
- hdu 1257 最少拦截系统(DP)
- php同时作为server端和client端(soapclient)的超时时间设置小结
- mmap msync munmap close
- 用eclipse新建JSP
- erlang:猜数字
- Ubuntu下配置Samba服务
- c语言计算几何系列题、
- 如何让你的 Android 显示gif格式的图片
- 老鸟学习python