Problem H
Restroom Monitor
Irma P. Freely (yes, we’ve hit a new low) is in charge of
the bank of restrooms at the Rest Pit truck stop. Every so
often a tour bus stops by and a load of passengers gets off to
use the restroom. Irma has a set of
Unfortunately, owing to shortages caused by the COVID
pandemic, there is only one roll of toilet paper. Not everyone
needs toilet paper, but only one person can be in a stall with
it at a time. Irma needs to figure out whether she can schedule
everyone so that they can all make use of her facilities before
their deadlines. Sounds like a lot of paperwork
Input
Input begins with a line containing two integers
Output
If it is possible to allocate everyone to stalls to meet their deadlines, display Yes. Otherwise, display No.
Sample Input 1 | Sample Output 1 |
---|---|
3 7 2 y 2 n 5 y 1 n 5 n 2 y 1 n |
Yes |
Sample Input 2 | Sample Output 2 |
---|---|
2 7 2 y 2 n 5 y 1 n 5 n 2 y 1 n |
No |