Crocodiles
Given the birth year and the death year of crocodiles, the problem is to find the maximum number of crocodiles alive at any given time.
Input
A file named crocodiles.in contains an integer (where ) on the first line, indicating the number of lines that follow. Each of the following lines contains two integers within the range [], representing respectively the birth year and the death year of each crocodile. There is a single space between the two integers.
Note that the death year is not included in the crocodile's lifespan. That is, if a crocodile is born in 2001 and dies in 2005, it lived for 4 years.
Output
A file named crocodiles.out containing an integer indicating the maximum number of living crocodiles at any given time. The output file should end with a newline character.
Example of Input - Output Data
STDIN (qubits.in)
4
12 50
10 60
-90000 -89950
48 55
STDOUT (qubits.out)
3
Maximum execution time: , sec.
Comments