POJ-1887-Testing the CATCHER
来源:互联网 发布:杭州软件外包情况 编辑:程序博客网 时间:2024/05/22 09:49
这个题其实就是求最长下降序列,我反向求的最长上升序列,用N*log(n)解决
代码:
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;const int maxn=10001;const int inf=1<<28;int a[maxn],g[maxn];int main(){ int cas=1; while(scanf("%d",&a[0])&&a[0]!=-1) {int cur=1;while(1){ scanf("%d",&a[cur]); if(a[cur]==-1)break; cur++;}for(int i=1;i<maxn;i++) g[i]=inf;int ans=0;for(int i=cur-1;i>=0;i--){ int k=lower_bound(g+1,g+cur+1,a[i])-g; g[k]=a[i]; ans=max(ans,k);}printf("Test #%d:\n",cas++);printf(" maximum possible interceptions: %d\n",ans);printf("\n"); } return 0;}
- poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- Poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ-1887-Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- POJ -1887-Testing the CATCHER
- POJ 1887 Testing the CATCHER.
- POJ 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER 经典DP
- Poj 1887 Testing the CATCHER(LIS)
- POJ 1887 Testing the CATCHER(LIS)
- jquery ajax中使用jsonp的限制
- ARM中断处理过程
- [转载] 关于扬声器
- POJ-3356-AGTC
- WRK-NtOpenProcess 的流程草图~
- POJ-1887-Testing the CATCHER
- 第十五章Sqoop(2)
- jQuery学习总结
- 第15章Sqoop(3)
- json数据持久到MySQL
- 绑定本地Service并与之通信
- 高效率编辑器 VIM-操作篇,非常适合 VIM 新手
- Ext.data.JsonReader
- c#连连看