Problem B
Greedily Increasing Subsequence
Given a permutation
Let
Your task is to, given a permutation
Input
The first line of input contains an integer
Output
First, output a line containing the length
Explanation of sample 1
In this case, we have the permutation
Sample Input 1 | Sample Output 1 |
---|---|
7 2 3 1 5 4 7 6 |
4 2 3 5 7 |
Sample Input 2 | Sample Output 2 |
---|---|
5 1 2 3 4 5 |
5 1 2 3 4 5 |
Sample Input 3 | Sample Output 3 |
---|---|
5 5 4 3 2 1 |
1 5 |