| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 (추가 시간 없음) | 2048 MB | 49 | 19 | 19 | 48.718% |
It's final exam season and Ashley is heading to her favorite library to cram for finals.
The library has a dedicated floor for studying where there are $r$ rows of $c$ tables evenly spaced. Each table only has room for one student, and some students have already arrived and claimed their favorite tables.
Because the floor is usually very quiet, it is possible to hear sounds from other students who are nearby -- for example, frustrated typing on a laptop keyboard or nervous leg shaking. Specifically, if one student is studying at the table in row $i_1$ and column $j_1,ドル and another student is studying at the table in row $i_2$ and column $j_2,ドル it is possible for the two students to hear sounds from each other if and only if $\sqrt{(i_1 - i_2)^2 + (j_1 - j_2)^2} \le d$.
With this, Ashley wants to find an empty table where she can hear as few other students as possible. Compute the minimum number of students that Ashley can hear if she selects her table optimally.
The first line of input has four integers $r,ドル $c$ (2ドル \leq r, c \leq 10^9$), $d$ (1ドル \leq d \leq 2,円 500$), and $n$ (1ドル \leq n \leq 10^3$ and $n \leq r \cdot c - 1$).
Each of the next $n$ lines contains two integers $i$ (1ドル \le i \le r$) and $j$ (1ドル \le j \le c$), indicating that a student is studying at the table at row $i$ and column $j$. It is guaranteed that no two students are sitting at the same table.
Output a single integer, which is the minimum number of students that Ashley can hear if she selects her table optimally.
3 2 1 3 1 1 2 2 3 1
2
ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 1 D번
ICPC > Regionals > North America > Mid-Central Regional > 2023 Mid-Central USA Programming Contest K번
ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 1 C번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 1 C번
ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 1 C번