"Dynamic planning" robot Corps

Source: Internet
Author: User

Issue V: "Dynamic planning" robot Corps Time limit: 1 Sec memory limit: up to MB
Submitted: 11 Resolution:
Submitted State [Discussion Version] The title describes the evil Wolf: "How do you feel these robots are smarter than me?" Is it not that AI can never surpass human beings? ”

Zenith Star: "You are so shortsighted, arrogant and foolish!" You know, if the conscious wisdom of life does not do what the unconscious universe has done in the endless years (producing intelligent life), it's like an ignorant monkey jumping on the keys for eons of time and jumping out of a Beethoven Nineth symphony, And the wise creature could not learn a simple serenade as absurd for thousands of years. If it is never done, is it in your philosophy that there is no mystery or agnosticism? You know there is no absolute. ”

Under the guidance of the Zenith Star, Tabrets built a robot regiment, the robot line, and the height of b1,b2,...,bn respectively. The tabrets was prepared to select a group of robots that meet the longest non-descending subsequence rules to form an elite guard. The so-called non-descending subsequence (longest increasing subsequence,lis) is defined as: a sequence consisting of n different integers b[n], if there is subscript i1<i2<...<il and b[i1]<b[i2]< <b[il], it is said that there is a non-descending sequence of length L.

such as 13,7,9,16,38,24,37,18,44,19,21,22,63,15. There is a non-descending subsequence with a 13<16<38<44<63 length of 5. However, it is observed that there is a non-descending subsequence with a 7<9<16<18<19<21<22<63 length of 8. So is there a longer non-descending subsequence? Please find out the length of the longest non-descending sub-sequence.

Enter the first behavior N, which represents the number of n (n≤100000). The value of the second action n number. Outputs an integer, which is the length of the longest non-descending sequence. Sample input
41 3 1 2
Sample output
2
problem-solving ideas: do several times, the results of each time a look but can not think how to do it. The main or the dynamic planning of the understanding is not clear, it is unclear what kind of open one-dimensional array, what kind of open two-dimensional array.
Then do the problem of independent thinking is too bad, always want to see other people's problem-solving process.
Reference to Problem solving: http://www.cnblogs.com/TWS-YIFEI/p/5592511.html
  
Code:
1#include <iostream>2#include <cstdio>3  4 using namespacestd;5  6 inta[100005];7 intsum[100005];8  9 intMain ()Ten { One     intN; A     intmaxx=0; -scanf"%d",&n); -      for(intI=0; i<n;i++){ thescanf"%d",&a[i]); -     } -sum[0]=1; -     intans=0; +      for(intI=1; i<n;i++){ -maxx=0; +         intb=0; A          for(intj=0; j<i;j++){ at             if(a[i]>A[j]) { -maxx=Max (maxx,sum[j]); -b=1; -             } -         } -         if(b==1){ insum[i]=maxx+1; -ans=Max (ans,sum[i]); to}Else{ +sum[i]=1; -         } the     } *printf"%d", ans); $  Panax Notoginseng     return 0; - } the   + /************************************************************** A problem:2263 the user:zz13 + language:c++ - Result: Correct $ time:240 Ms $ memory:2476 KB - ****************************************************************/

Dynamic planning Robot Legion

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.