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

32549번 - Avoiding the Abyss 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB62322663.415%

문제

You are standing on a point with integer coordinates $(x_s, y_s)$. You want to walk to the point with integer coordinates $(x_t, y_t)$. To do this, you can walk along a sequence of line segments. But there is a swimming pool in your way. The swimming pool is an axis aligned rectangle whose lower left corner is on the point $(x_l, y_l)$ and the upper right corner is on the point $(x_r, y_r)$. You cannot ever cross the swimming pool, not even on the border. However, it is dark and you do not know the coordinates $(x_l, y_l)$ and $(x_r, y_r)$. Instead, you threw a rock into the pool which revealed that the point $(x_p, y_p)$ is in the pool (or on the boundary).

Find a way to walk from the start to the end point along a sequence of line segments, so that you never cross the swimming pool.

입력

The first line contains two integers $x_s$ and $y_s$ ($-10^4 \leq x_s, y_s \leq 10^4$).

The second line contains two integers $x_t$ and $y_t$ ($-10^4 \leq x_t, y_t \leq 10^4$).

The third line contains two integers $x_p$ and $y_p$ ($-10^4 \leq x_p, y_p \leq 10^4$).

The problem is not adaptive, i.e. for every test case there exist four integers $x_l, y_l, x_r, y_r$ ($-10^4 \leq x_l < x_r \leq 10^4,ドル $-10^4 \leq y_l < y_r \leq 10^4$) that constitute a swimming pool. The start and end points are always strictly outside the swimming pool, and the point $(x_p,y_p)$ is inside (or on the border). The start and end points are always distinct.

출력

First, print one integer $N$ (0ドル \leq N \leq 10$), the number of points in between the start and end point that you want to visit. Then, print $N$ lines, the $i$th containing two integers $x_i, y_i$. These coordinates must satisfy $-10^9 \leq x_i, y_i \leq 10^9$. Note that these are not the same bounds than on the other coordinates.

This means that you will walk along straight line segments between $(x_s, y_s), (x_1, y_1), \dots, (x_N, y_N), (x_t, y_t)$ such that none of the line segments touch the swimming pool. It can be proven that a solution always exists.

제한

예제 입력 1

0 0
4 4
2 2

예제 출력 1

2
0 3
1 4

This picture represents sample 1. The path taken avoids the hidden pool, but based on the information given it could also have intersected it. So the sample solution was quite lucky here.

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2024 A번

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

출처

대학교 대회

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

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