#C1041. Maximum Non-Overlapping Meetings
Maximum Non-Overlapping Meetings
Maximum Non-Overlapping Meetings
You are given a list of meetings, where each meeting is represented by its start and end time. Your task is to determine the maximum number of meetings you can attend without any overlap. A meeting can be attended if its start time is greater than or equal to the end time of the last meeting you attended.
This condition can be formulated in LaTeX as: \( start \geq end_{last} \).
Please read the input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The first value in the input is an integer \( N \) representing the number of meetings. Following this, there are \( N \) pairs of integers. Each pair contains two integers: the start time and the end time of a meeting, separated by spaces.
Example:
5
1 2
3 4
0 6
5 7
8 9
outputFormat
Output a single integer representing the maximum number of non-overlapping meetings that can be attended.
Example:
4
5 1 2 3 4 0 6 5 7 8 9
4