#B2151. Longest Consecutive Normal Blood Pressure Hours
Longest Consecutive Normal Blood Pressure Hours
Longest Consecutive Normal Blood Pressure Hours
In the intensive care unit, the patient’s blood pressure is measured every hour. A measurement is considered normal if the systolic pressure is between $90$ and $140$ (inclusive) and the diastolic pressure is between $60$ and $90$ (inclusive). Given a series of blood pressure measurements, compute the longest consecutive period (in hours) during which the blood pressure was normal.
inputFormat
The first line contains an integer $n$ representing the number of measurements. Each of the following $n$ lines contains two integers denoting the systolic and diastolic pressures respectively.
outputFormat
Output a single integer representing the longest consecutive number of hours during which the blood pressure measurements were normal.
sample
5
120 80
100 70
110 80
130 85
140 90
5