#K48352. Maximum Activities with Strictly Increasing Benefits
Maximum Activities with Strictly Increasing Benefits
Maximum Activities with Strictly Increasing Benefits
You are given a list of integers representing the benefit values of different activities. Your task is to select the maximum number of activities such that the benefit values of the selected activities are in strictly increasing order. Since any collection of distinct numbers can be arranged in strictly increasing order, this problem reduces to determining the number of distinct benefit values in the list.
The input consists of an integer (n) on the first line, representing the number of activities, followed by a line with (n) integers representing the benefit values of each activity.
Your program should output a single integer representing the maximum number of activities that can be selected.
Example:
Input:
7
4 5 2 4 3 3 6
Output:
5
In this example, the distinct benefit values are ({2, 3, 4, 5, 6}), so the answer is 5.
inputFormat
The first line contains a single integer (n) ((1 \leq n \leq 10^5)), the number of activities. The second line contains (n) space-separated integers representing the benefit values of the activities.
outputFormat
Output a single integer, which is the maximum number of activities that can be selected such that their benefit values are in strictly increasing order.## sample
7
4 5 2 4 3 3 6
5