IV Olimpiada Informatyczna 1996/1997
|
Task: REZ
|
Author: Wojciech Guzicki
|
III stage contest |
Source file | REZ.??? (e.g. PAS,C, CPP) |
Executable file | REZ.EXE |
Input file | REZ.IN |
Output file | REZ.OUT |
We have a lecture hall at our disposal. Lecturers place orders in which they specify at what time their lecture begins and at what time it ends. We want to make maximal use of the hall. We accept some orders and reject others and our aim is to achieve the longest possible time of lectures in the hall. We assume that at the moment when one lecture ends another can begin.
In each of the following n lines there are written two integers p and k, separated by a single space, 0 <= p < k <= 30000. Such a pair of integers represents an order for the hall. The lecture is to begin at time p and end in time k.
12 1 2 3 5 0 4 6 8 7 13 4 6 9 10 9 12 11 14 15 19 14 16 18 20the correct result is the text file REZ.OUT
16