Problem B
Worst Weather Ever

“Man, this year has the worst weather ever!”, David said as he sat crouched in the small cave where we had sought shelter from yet another sudden rainstorm.
“Nuh-uh!”, Diana immediately replied in her traditional know-it-all manner.
“Is too!”, David countered cunningly.
Terrific. Not only were we stuck in this cave, now we would have to listen to those two nagging for at least an hour. It was time to cut this discussion short.
“Big nuh-uh. In fact, 93 years ago it had already rained five times as much by this time of year.”
“Duh”, David capitulated, “so it’s the worst weather in 93 years then.”
“Nuh-uh, this is actually the worst weather in 23 years.”, Diana again broke in.
“Yeah, well, whatever”, David sighed, “Who cares anyway?”.
Well, dear contestants, you care, don’t you?
The Problem
Your task is to, given information about the amount of rain
during different years in the history of the universe, and a
series of statements in the form “Year
-
The amount of rain during these two years and all years between them is known.
-
It rained at most as much during year
as it did during year . -
For every year
satisfying , the amount of rain during year was less than the amount of rain during year .
We say that such a statement might be true if there is an assignment of amounts of rain to years for which there is no information, such that the statement becomes true. We say that the statement is false otherwise.
Input
The input will consist of several test cases, each consisting of two parts.
The first part begins with an integer
The second part of a test case starts with an integer
There is a blank line between test cases. The input is
terminated by a case where
Technical note: Due to the size of the input, the use of cin/cout in C++ might be too slow in this problem. Use scanf/printf instead. In Java, make sure that both input and output is buffered.
Output
There should be
Separate the output of two different test cases by a blank line.
Sample Input 1 | Sample Output 1 |
---|---|
4 2002 4920 2003 5901 2004 2832 2005 3890 2 2002 2005 2003 2005 3 1985 5782 1995 3048 2005 4890 2 1985 2005 2005 2015 0 0 |
false true maybe maybe |