1134 Maximum increment subsequence (violent writing)

Source: Internet
Author: User

Can be written in two points ...

Base time limit: 1 seconds space limit: 131072 KB score: 0 Difficulty: Basic collection focus on giving an array of length n to find the longest increment subsequence of this array. (incrementing a subsequence means that the elements of the subsequence are incremented) For example: 5 1 6 8 2 4 5 10, the maximum increment subsequence is 1 2 4 5 10. Input
Line 1th: 1 number n,n is the length of the sequence (2 <= N <= 50000) 2-n + 1 lines: 1 numbers per line, elements of the corresponding sequence ( -10^9 <= s[i] <= 10^9)
Output
Outputs the longest increment of the length of a subsequence.
Input example
8516824510
Output example
5
Related issues maximum increment subsequence V2 160 maximum increment subsequence number of the longest ascending sub-series It's very ingenious ... Code:
1#include <cstdio>2#include <cmath>3#include <cstring>4#include <string>5#include <algorithm>6#include <queue>7#include <stack>8#include <map>9#include <Set>Ten#include <vector> One#include <iostream> A using namespacestd; - #defineFor0 (i, n) for (int i=0; i< (n); ++i) - #defineFor1 (i,a,n) for (int i= (a); i<= (n); ++i) the #defineFor2 (i,a,n) for (int i= (a);i< (n); ++i) - #defineFor3 (i,a,n) for (int i= (a); i>= (n);-I.) - #defineFor4 (i,a,n) for (int i= (a);i> (n); - #defineCC (i,a) memset (i,a,sizeof (i)) + #defineLL Long Long - #defineMOD 1000000007 + #defineINF 0x3f3f3f3f A #defineMAX 50100 at  - intDp[max],num[max]; - intN; -  - intMain () - { inscanf"%d",&n); -memset (Dp,inf,sizeof(DP)); tomemset (Num,inf,sizeof(num)); +      for(intI=0; i<n; i++) -scanf"%d",&dp[i]); the     intPath=0; *      for(intI=0; i<n; i++){ $          for(intj=0; j<n; J + +){Panax Notoginseng             if(dp[i]<Num[j]) { -num[j]=Dp[i]; the                 if(path<j) +Path=J; A                  Break; the             } +         } -     } $printf"%d\n", path+1); $}

1134 Maximum increment subsequence (violent writing)

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.