#C2705. Presentation Scheduling

    ID: 46051 Type: Default 1000ms 256MiB

Presentation Scheduling

Presentation Scheduling

You are given an exhibition duration M and a number of authors A. Each author has a presentation with a specified duration. The task is to schedule all presentations sequentially within the exhibition period without any overlaps.

If the sum of the presentation durations exceeds M or a presentation cannot be fully accommodated, output No Schedule Possible. Otherwise, output the schedule starting from time 0 by listing consecutively the start and end times for each presentation.

The scheduling is performed in the order in which the durations are provided. The schedule must adhere to the following formula for each presentation i:

\(\text{start}_i = \sum_{j=0}^{i-1}\text{duration}_j\) and \(\text{end}_i = \text{start}_i + \text{duration}_i\).

inputFormat

The first line contains two integers M and A, where M is the total duration of the exhibition and A is the number of authors. The second line contains A space-separated integers representing the duration of each presentation.

outputFormat

If scheduling is possible, print Schedule Possible on the first line, followed by A lines each containing two space-separated integers indicating the start and end times of each presentation. If scheduling is not possible, output No Schedule Possible.

## sample
10 3
3 3 4
Schedule Possible

0 3 3 6 6 10

</p>