Topic Portal
1 /*2 lis Template title: N-Longest descent sub-sequence, longest ascending sub-sequence greedy procedure after re-filling:)3 */4#include <cstdio>5#include <iostream>6#include <cstring>7#include <string>8#include <algorithm>9 using namespacestd;Ten One Const intMAXN = 1e4 +Ten; A Const intINF =0x3f3f3f3f; - intA[MAXN]; - intDP[MAXN]; the - voidLIS (intN) - { -Memset (DP,0,sizeof(DP)); + - intAns =0; + for(intI=1; i<=n; ++i) A { atDp[i] =1; - for(intj=1; j<i; ++j) - { - if(A[i] >A[j]) - { - if(Dp[i] < Dp[j] +1) Dp[i] = Dp[j] +1; in } - } toAns =Max (ans, dp[i]); + } - theprintf ("%d\n", ans); * } $ Panax Notoginseng intMainvoid)//HDOJ 1257 minimum interception system - { the //freopen ("hdoj_1257.in", "R", stdin); + A intN; the while(SCANF ("%d", &n) = =1) + { - for(intI=1; i<=n; ++i) scanf ("%d", &a[i]); $ LIS (n); $ } - - return 0; the}
LIS HDOJ 1257 Minimum interception system