#K65717. Can Attend Meetings

    ID: 32260 Type: Default 1000ms 256MiB

Can Attend Meetings

Can Attend Meetings

You are given a list of meeting time intervals in the format ( (start, end) ), where each meeting is represented by its start time and end time. Your task is to determine if a single person can attend all meetings without any overlap. Two meetings ( (s_1, e_1) ) and ( (s_2, e_2) ) are considered non-overlapping if ( e_1 \leq s_2 ) or ( e_2 \leq s_1 ).

Note: The input may also represent an empty list of meetings, in which case the answer is considered ( \textbf{True} ) (i.e., no conflicts).

inputFormat

The input is given from standard input (stdin).

The first line contains a single integer ( N ) denoting the number of meetings. Each of the following ( N ) lines contains two space-separated integers representing the start and end time of a meeting. If ( N = 0 ), it indicates that there are no meetings.

outputFormat

Output a single line to standard output (stdout) containing either ( True ) if a person can attend all meetings without overlapping, or ( False ) if there is any conflict.## sample

3
1 3
3 5
5 8
True