Logo
(追記) (追記ここまで)

31509번 - Cramming for Finals 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 (추가 시간 없음) 2048 MB49191948.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.

제한

예제 입력 1

3 2 1 3
1 1
2 2
3 1

예제 출력 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번

  • 문제를 만든 사람: Bowen Yu
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /