LIS HDOJ 1257 Minimum interception system

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.