#C3957. Stacking Boxes
Stacking Boxes
Stacking Boxes
You are given a set of boxes, each with a specific weight. Your task is to compute the maximum number of boxes that can be stacked on top of each other such that the weights are in strictly increasing order from bottom to top.
This problem is equivalent to finding the length of the longest increasing subsequence (LIS) from a list of numbers. Note that boxes with equal weights cannot be stacked together.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer
n
representing the number of boxes. - The second line contains
n
space-separated integers, where each integer represents the weight of a box.
outputFormat
Output to standard output (stdout) a single integer, which is the maximum number of boxes that can be arranged in a strictly increasing order by their weights.
## sample5
1 3 2 4 5
4
</p>