아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Kathmandu

면접 대비

시간 제한1초메모리 제한1024 MB

요약
식사가 제공되는 시각 사이에 길이 T인 빈 구간이 있는지 판단하여, 모든 식사를 먹으면서 T분을 연속으로 잘 수 있는지 확인한다.
난이도

보통10점 중 4점

유형
배열, 그리디
정답자
아직 제출이 없습니다

문제

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, yi. 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?

입력

The first line of input contains three integers, T, D, M (1 ≤ T, D ≤ 105, 0 ≤ M ≤ 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 yi (0 ≤ yi ≤ D). These integers represent the times at which each meal is going to be served, and are given in chronological order.

출력

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’.

예제5

  1. 예제 1

    입력
    3 10 3
    2
    4
    7
    
    예상 출력
    Y
    
  2. 예제 2

    입력
    4 10 3
    2
    4
    7
    
    예상 출력
    N
    
  3. 예제 3

    입력
    5 5 0
    
    예상 출력
    Y
    
  4. 예제 4

    입력
    4 8 2
    5
    7
    
    예상 출력
    Y
    
  5. 예제 5

    입력
    4 8 2
    3
    4
    
    예상 출력
    Y