#K51252. Time Slot Validation

    ID: 29046 Type: Default 1000ms 256MiB

Time Slot Validation

Time Slot Validation

Given multiple participants, each with a series of time intervals, your task is to verify the validity of these intervals. An interval is valid if it satisfies the condition \( s < e \), where \( s \) is the start time and \( e \) is the end time. Moreover, no two intervals for the same participant should overlap. When the intervals are sorted in increasing order of \( s \), for any consecutive intervals \((s_i,e_i)\) and \((s_{i+1},e_{i+1})\), it must hold that \( e_i \leq s_{i+1} \).

If all participants have valid, non-overlapping intervals, print "All slots are valid"; otherwise, print "Invalid slots found".

inputFormat

The input is read from standard input (stdin). The first line contains an integer \( n \) representing the number of participants. Each of the following \( n \) lines describes one participant in the following format:

id m s1 e1 s2 e2 ... s(m/2) e(m/2)

Here, id is a string identifying the participant, m is an even integer indicating the total number of time values provided (which form \( m/2 \) intervals), and each pair \( s, e \) represents the start and end times of an interval.

outputFormat

Output a single line to standard output (stdout), which is either "All slots are valid" if every participant's intervals are valid and non-overlapping, or "Invalid slots found" if any participant has an invalid or overlapping interval.

## sample
3
p1 4 1 3 4 5
p2 4 2 6 7 8
p3 6 5 9 10 12 13 14
All slots are valid

</p>