#C5874. Minimum Days for Scheduling Workshops

    ID: 49571 Type: Default 1000ms 256MiB

Minimum Days for Scheduling Workshops

Minimum Days for Scheduling Workshops

You are given an integer \( n \) representing the number of workshops, and a list of \( n \) workshops. Each workshop is described by two integers: \( t \), the starting time slot, and \( d \), the duration. The ending time for a workshop can be calculated as \( t + d - 1 \).

Your task is to determine the minimum number of days required to schedule all the workshops such that no two workshops on the same day overlap. A workshop can be scheduled on a day if its starting time is not less than the ending time of the last workshop scheduled on that day. Otherwise, it must be assigned to a new day.

Input is provided via standard input (stdin) and output must be printed on standard output (stdout).

inputFormat

The input begins with a single integer \( n \) representing the number of workshops. This is followed by \( n \) lines, each containing two space-separated integers \( t \) and \( d \), which denote the starting time and duration of a workshop respectively.

outputFormat

Output a single integer representing the minimum number of days required to schedule all workshops without any overlap.

## sample
3
1 4
2 3
4 1
2