#K15696. Longest Consecutive Episodes Sequence
Longest Consecutive Episodes Sequence
Longest Consecutive Episodes Sequence
You are given a series of users, each with a list of watched episode numbers. Your task is to determine the maximum length of a consecutive sequence that occurs in any user's episode list. A sequence is considered consecutive if, for any element \(a_i\) in the sequence, the next element is exactly \(a_i+1\). For example, if a user watches episodes 5, 6, 7, that forms a consecutive sequence of length 3.
Note: Each user's episode list is provided in the order in which the episodes were watched.
inputFormat
The input is provided via standard input (stdin) and has the following format:
- The first line contains an integer \(U\), the number of users.
- For each user, there are two lines:
- The first line contains an integer \(K\) representing the number of episodes the user watched.
- The second line contains \(K\) space-separated integers denoting the episode numbers in the order they were watched.
outputFormat
The output should be a single integer printed to standard output (stdout) which is the length of the longest consecutive sequence of watched episodes observed among all users.
## sample2
5
1 2 3 5 6
3
10 11 12
3