Longest Ordered SubsequenceTime Limit: 2000 MS Memory Limit: 65536 KTotal Submissions: 25229 Accepted: 10957 Description A numeric sequence of ai is ordered if a1 <a2 <... <. let the subsequence of the given numeric sequence (a1, a2 ,..., aN) be any sequence (ai1, ai2 ,..., aiK), where 1 <= i1 <i2 <... <iK <= N. for example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g ., (1, 7), (3, 4, 8) and other others. all longest ordered subsequences are of length 4, e. g ., (1, 3, 5, 8 ). your program, when given the numeric sequence, must find the length of its longest ordered subsequence. input The first line of input file contains the length of sequence N. the second line contains the elements of sequence-N integers in the range from 0 to 10000 each, separated by spaces. 1 <= N <= 1000 Output file must contain a single integer-the length of the longest ordered subsequence of the given sequence. sample Input 71 7 3 5 9 4 8 Sample Output 4 Source Northeastern Europe 2002, Far-Eastern Subregion longest ascending subsequence [cpp] # include <stdio. h> # include <math. h> # include <string. h> int a [1100], n; int main () {int find (); int I, j, m, s, t, max; scanf ("% d ", & n); for (I = 0; I <= n-1; I ++) {scanf ("% d", & a [I]);} max = find (); printf ("% d \ n", max); return 0;} int find () {int I, j, dp [1100], max; apsaradb for memset (dp, 0, sizeof (dp); dp [0] = 1; for (I = 1; I <= n-1; I ++) {max = 0; for (j = 0; j <= I-1; j ++) {if (a [I]> a [j]) {if (dp [j]> max) {max = dp [j] ;}} dp [I] = max + 1 ;}for (I = 0, max = 0; I <= n-1; I ++) {if (dp [I]> max) {max = dp [I] ;}} return max ;}