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

33586번 - Grove 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 2048 MB218861.538%

문제

You want to plant trees in a square lawn of size $n \times n$ whose corners have Cartesian coordinates $(0, 0),ドル $(n, 0),ドル $(0, n),ドル and $(n, n)$. Trees can only be planted at locations with integer coordinates. Every tree will grow roots within a disk of radius $r$ centered at the location where the tree was planted; such disks must be fully contained in the lawn (possibly touching the boundary of the lawn) and can only intersect each other on their boundaries.

Find a configuration that maximizes the number of trees.

입력

The first and only line contains an integer $n$ (1ドル ≤ n ≤ 20$) and a real number $r$ (0ドル < r ≤ n/2$) — the length of the sides of the lawn, and the radius of the disks where each tree will grow roots. The real number $r$ is given in decimal notation with at least 1ドル$ and at most 3ドル$ digits after the decimal point.

출력

In the first line, print the maximum number $m$ of trees that can be planted.

In the next $m$ lines, print a configuration that maximizes the number of trees. Specifically, in the $(i + 1)$-th line, print two integers $x$ and $y$ — the coordinates of the location where the $i$-th tree should be planted. You can print the trees in any order.

If there are multiple solutions, print any of them.

제한

예제 입력 1

6 1.241

예제 출력 1

2
4 2
2 4

The sample output is shown in the following figure. Note that this is not the only configuration that maximizes the number of trees.

예제 입력 2

9 2.0

예제 출력 2

4
2 2
7 2
2 6
6 6

The sample output is shown in the following figure. Note that this is not the only configuration that maximizes the number of trees.

힌트

출처

ICPC > Regionals > Europe > European Championship > The 2024 ICPC European Championship A번

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

출처

대학교 대회

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

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