Preparing NOJ

Kathmandu

0ms 0K

Description:

The pandemic is getting better and you can finally do the thing you've been dreaming of for the past few years: eat at your favorite restaurant! The restaurant happens to be in Kathmandu, but that's fine, you can always take a plane.

The problem is that planes almost always leave you restless. You consider yourself properly rested if you can sleep for $$$T$$$ uninterrupted minutes, which means you are never awake from a certain moment $$$t$$$ to $$$t+T$$$. Also, you're a very easy sleeper: you can fall asleep at the start of any minute and wake up at the end of any minute.

Of course, if you sleep too much you will miss all the airplane meals! That is unacceptable, as no opportunity for free food should go to waste.

Luckily, the airplane company sent you the whole flight schedule: the duration of the flight, $$$D$$$ minutes, the number of meals that are going to be served, $$$M$$$, and the exact time they will serve the meals, $$$y_i$$$. You need to be awake at the time the meal is being served to be able to eat it, otherwise, the steward will not serve you. Since you're always hungry, you will devour the meal instantly.

Now you are wondering, for the optimal plane traveling experience, can you get properly rested and still eat all meals during the flight?

Input:

The first line of input contains three integers, $$$T$$$, $$$D$$$, $$$M$$$ ($$$1 \leq T, D \leq 10^5$$$, $$$0 \leq M \leq 1000$$$), representing, respectively, the number of minutes you need to sleep without interruption to be properly rested, the duration of the flight and the number of meals that are going to be served during the flight.

Each of the next $$$M$$$ lines contains an integer $$$y_i$$$ ($$$0 \leq y_i \leq D$$$). These integers represent the times at which each meal is going to be served, and are given in chronological order.

Output:

Output a line containing one character. If you can get properly rested and still eat all meals during the flight, write the upper case letter 'Y'; otherwise write the uppercase letter 'N'.

Sample Input:

3 10 3
2
4
7

Sample Output:

Y

Sample Input:

4 10 3
2
4
7

Sample Output:

N

Sample Input:

5 5 0

Sample Output:

Y

Sample Input:

4 8 2
5
7

Sample Output:

Y

Sample Input:

4 8 2
3
4

Sample Output:

Y

Info

CodeForces Gym

Provider CodeForces Gym

Origin 2021-2022 ACM-ICPC Brazil Subregional Programming Contest

Code GYM103388K

Tags

Submitted 3

Passed 0

AC Rate 0%

Date 11/01/2021 22:23:56

Related

Nothing Yet