시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB4014833.333%

문제

The IOI Kingdom is represented as a square grid of $L$ rows and $L$ columns. The rows are numbered $1, 2, \dots , L$ from top to bottom and the columns are numbered $1, 2, \dots , L$ from left to right. A cell at row $i$ ($1 ≤ i ≤ L$) and column $j$ ($1 ≤ j ≤ L$) is denoted as cell $(i, j)$.

Recently, due to a widespread infection in the IOI Kingdom, the demand for improved medical facilities has increased. In response, the king, Bitaro, has decided to build hospitals in the four corners of the grid, which are cell $(1, 1)$, cell $(1, L)$, cell $(L, 1)$, and cell $(L, L)$. Each hospital is equipped with one ambulance.

The cautious Bitaro decided to run a simulation to prepare for actual emergency calls from patients. In the scenario he envisioned, emergency calls from $N$ patients arrive at time $0$, and he wants to determine whether all patients can be transported to one of the hospitals by time $T$. The $k$-th patient ($1 ≤ k ≤ N$) is located at cell $(X_k, Y_k)$.

The ambulances transport patients according to the following rules:

  • Each ambulance can start moving at time $0$ or later. It repeats the following (possibly $0$ times): depart from its hospital, move to the patient’s location, pick up the patient, and then return to the hospital to drop off the patient.
  • Each ambulance can carry at most $1$ patient at a time.
  • Each ambulance can only transport patients to the hospital where it was initially stationed. Patients cannot be dropped off at any location other than a hospital.
  • Each ambulance moves to an adjacent cell (up, down, left, or right) in $1$ unit of time. The time taken to pick up and drop off a patient can be ignored.
  • Ambulances from different hospitals may occupy the same cell at the same time.

Unfortunately, Bitaro was unable to determine the outcome of his envisioned scenario, so he has asked you to investigate it on his behalf.

Given the size of the IOI Kingdom and the scenario envisioned by Bitaro, write a program to determine whether all patients can be transported to a hospital by time $T$.

입력

The input is given from Standard Input in the following format:

$L$ $N$ $T$

$X_1$ $Y_1$

$X_2$ $Y_2$

$\vdots$

$X_N$ $Y_N$

출력

Print Yes if all patients can be transported to a hospital by time $T$ in the scenario envisioned by Bitaro. Otherwise, print No. The output should consist of a single line.

제한

  • $3 ≤ L ≤ 10\, 000$.
  • $1 ≤ N ≤ 160$.
  • $1 ≤ T ≤ 20\, 000$.
  • $1 ≤ X_k ≤ L$ ($1 ≤ k ≤ N$)
  • $1 ≤ Y_k ≤ L$ ($1 ≤ k ≤ N$)
  • $(X_k, Y_k)$ is not equal to any of $(1, 1)$, $(1, L)$, $(L, 1)$, or $(L, L)$. ($1 ≤ k ≤ N$)
  • All input values are integers.

서브태스크

번호배점제한
14

$T ≤ 50$.

28

$T ≤ 160$.

35

$N ≤ 10$.

418

$N ≤ 20$.

515

$N ≤ 45$. $L$ is a odd number, and $Y_k = \frac{L+1}{2}$ ($1 ≤ k ≤ N$).

631

$N ≤ 45$.

719

No additional constraints.

예제 입력 1

6 4 8
1 3
2 2
3 4
5 5

예제 출력 1

Yes

By transporting the $1$st and $2$nd patients to the hospital at $(1, 1)$, the $3$rd patient to the hospital at $(1, 6)$, and the $4$th patient to the hospital at $(6, 6)$, all patients can be transported to a hospital by time $8$, so the output is Yes.

For example, if the ambulance stationed at the hospital in $(1, 1)$ moves in the following order, it can transport both the $1$st and $2$nd patients to the hospital by time $8$.

Time Ambulance Status
$0$ Departs from cell $(1, 1)$
$1$ Arrives at cell $(2, 1)$
$2$ Arrives at cell $(2, 2)$, picks up the $2$nd patient, and departs
$3$ Arrives at cell $(1, 2)$
$4$ Arrives at cell $(1, 1)$, drops off the $2$nd patient, and departs
$5$ Arrives at cell $(1, 2)$
$6$ Arrives at cell $(1, 3)$, picks up the $1$st patient, and departs
$7$ Arrives at cell $(1, 2)$
$8$ Arrives at cell $(1, 1)$, drops off the $1$st patient

This sample input satisfies the constraints of subtasks 1, 2, 3, 4, 6 and 7.

예제 입력 2

9 5 19
5 5
5 5
7 5
2 5
9 5

예제 출력 2

No

Since it is not possible to transport all patients to a hospital by time $19$, the output is No.

This sample input satisfies the constraints of all subtasks.

예제 입력 3

7 7 16
6 1
2 4
4 5
5 5
3 4
6 4
5 1

예제 출력 3

Yes

This sample input satisfies the constraints of subtasks 1, 2, 3, 4, 6 and 7.

예제 입력 4

200 15 800
126 45
196 40
43 58
96 13
28 33
44 55
60 22
58 156
135 183
44 29
92 182
157 138
30 132
175 87
166 57

예제 출력 4

No

This sample input satisfies the constraints of subtasks 4, 6 and 7.

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.