poj 1631(Bridging signals LIS)nlogn
2013-08-26 16:36
507 查看
题目链接:点击打开链接、
题目大意:绕了这么多圈子,其实还是求最长上升子序列
题目分析:用nlog n
与 poj2533一样啊:点击打开链接
题目大意:绕了这么多圈子,其实还是求最长上升子序列
题目分析:用nlog n
与 poj2533一样啊:点击打开链接
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> using namespace std; const int maxn=40005; int stack[maxn]; int main() { freopen("out.txt","w",stdout); freopen("in.txt","r",stdin); int n,i,top,data,j,p; scanf("%d",&n); while(n--) { scanf("%d",&p); top=0;stack[0]=-1; for(i=0;i<p;i++) { scanf("%d",&data); if(data>stack[top]) stack[++top]=data; else { int l=1,r=top,mid; while(l<=r) { mid=(l+r)/2; if(data>stack[mid]) l=mid+1; else r=mid-1; } stack[l]=data; } } printf("%d\n",top); } }
相关文章推荐
- POJ-1631 Bridging signals LIS
- poj 1631 Bridging signals LIS 最长非递减子序列
- POJ 1631 Bridging signals LIS(最长递增子序列) +nlogn算法+二分查找
- POJ 1631 Bridging signals LIS(最长递增子序列) +nlogn算法+二分查找
- poj 1631 Bridging signals dp LIS
- POJ_1631_Bridging_Signals_(动态规划,LIS)
- POJ 1631 Bridging signals & 2533 Longest Ordered Subsequence
- POJ 1631 nlogn求LIS
- poj1631 Bridging signals
- POJ 1631 nlogn求LIS
- POJ 1631(O(nlogn)LIS的2种做法)
- POJ 1631 Bridging signals DP(最长上升子序列)
- POJ-1631-Bridging signals-( 水LIS-O(nlogn) -DP)
- poj 1631 Bridging signals
- 刷题——Bridging signals POJ - 1631
- poj 1631 LIS nlogn
- [POJ](1631)Bridging signals ---- LIS+O(nlogn)优化(二分)
- poj 1631--Bridging signals
- HDU1950 Bridging signals LIS优化
- (经典)POJ-1631 LIS,偏序问题