#K58852. Workshop Scheduling

    ID: 30734 Type: Default 1000ms 256MiB

Workshop Scheduling

Workshop Scheduling

You are given n workshops, each represented by its start time and end time. A workshop is denoted as \( (s, e) \) (with \( s < e \)). The task is to determine whether it is possible to schedule all workshops without any overlap. Two workshops do not overlap if the end time of one is less than or equal to the start time of the next.

Note: Workshops can be scheduled back-to-back; that is, if one workshop ends at time \( t \) and the next starts at time \( t \), they do not overlap.

inputFormat

The first line of input contains a single integer \( n \) representing the number of workshops. Each of the next \( n \) lines contains two space-separated integers \( s \) and \( e \), representing the start and end times of a workshop respectively.

outputFormat

Output a single line: YES if all workshops can be scheduled without overlap; otherwise, output NO.

## sample
3
1 3
3 5
5 7
YES