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

25250번 - Flappy Bird 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.75 초 (추가 시간 없음) 1024 MB2011642.857%

문제

Help the bird Faby to navigate through a sequence of $n$ pairs of pipes, by finding the shortest line he can fly on to reach his destination. For simplicity, we represent Faby as a single point in the plane and assume every pipe has width zero. This way, the gap between every pair of pipes can be represented as an interval on the $y$ axis. The bird starts out at $s = (x_s, y_s)$ and his goal is to reach $t = (x_t, y_t)$. Find the shortest line from $s$ to $t,ドル passing through all intervals in between in increasing order of their $x$ coordinates.

Figure F.1: Visualisation of the second sample input. The red lines represent the intervals and the black line the shortest possible path. Faby and the black dots are the points in the output. Note that $(2, 1)$ can optionally be included in the output too.

입력

The input consists of:

  • One line with four integers $x_s, y_s, x_t$ and $y_t$ ($-10^9 \le x_s, y_s, x_t, y_t \le 10^9$), the start and end points.
  • One line with an integer $n\ (0 \le n \le 10^6),ドル the number of intervals.
  • $n$ lines, the $i$th of which contains three integer $x_i, y_{i,1}$ and $y_{i,2}$ ($-10^9 \le x_i, y_{i, 1}, y_{i, 2} \le 10^9,ドル $y_{i, 1} < y_{i, 2}$), the intervals.

It can be assumed that $x_s < x_1 < \dots < x_n < x_t$.

출력

Output a sequence of $k$ $(2 \le k \le n+2$) points $p_1, \dots, p_k,ドル one per line, such that:

  • All points have integer coordinates.
  • $p_1 = s$ and $p_k = t$.
  • Let $P$ be the path obtained by connecting $\overline{p_i p_{i+1}}$ for all 1ドル \le i < k$. Then:
    • $P$ passes through all intervals in increasing order of their $x$ coordinates.
    • The length of $P$ is minimal.

If there are multiple valid solutions, you may output any one of them.

제한

예제 입력 1

0 0 10 0
1
5 -10 10

예제 출력 1

0 0
10 0

예제 입력 2

0 0 10 0
4
2 1 3
4 2 3
7 0 2
9 -2 -1

예제 출력 2

0 0
4 2
9 -1
10 0

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2021 F번

  • 문제를 만든 사람: Florian Leimgruber

채점 및 기타 정보

  • 이 문제의 채점 우선 순위는 2이다.
(追記) (追記ここまで)

출처

대학교 대회

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

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