#K58447. Longest Increasing Sensor Sequence

    ID: 30644 Type: Default 1000ms 256MiB

Longest Increasing Sensor Sequence

Longest Increasing Sensor Sequence

You are given a series of events recorded from sensors. Each event consists of a timestamp t, a sensor identifier s, and a reading value v. Your task is to determine the length of the longest subsequence for any sensor in which the readings strictly increase consecutively. In other words, for a given sensor, if its readings at consecutive events are v₁, v₂, ..., vₖ such that \(v₁ < v₂ < \dots < vₖ\), then the length of that sequence is \(k\), and you must output the maximum \(k\) over all sensors.

Note: The condition for a valid increasing sequence is given by the inequality \(v > \text{previous value}\).

inputFormat

The input is given in standard input (stdin). The first line contains an integer n which denotes the total number of events. The following n lines each contain three space-separated integers representing the timestamp t, the sensor identifier s, and the reading value v respectively.

outputFormat

Output a single integer to standard output (stdout), which is the length of the longest sequence of consecutive increasing readings for any sensor.

## sample
7
1 1 10
2 1 12
3 1 15
4 2 5
5 1 9
6 1 11
7 1 13
3

</p>