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

32678번 - Rocky Mountain 다국어

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

문제

The Rocky Mountain Cable (RMC) company is planning to run cables from the top peak of the Rocky Mountains to lower points in the mountain range, so that cable cars can be used to transport tourists to the highest peak. A cable must connect from one of the potential sites to the highest peak in a straight line, but the cable cannot cross any part of the mountain range. However, the cable may coincide with a slope.

In order to serve the most number of tourists, it is desirable to connect the cable from the highest peak to the lowest possible site. Help the company determine the best possible site on the left and the right of the highest peak. If there are ties, choose the leftmost site on the left, and the rightmost site on the right.

The mountain range is specified by $N$ sites $(x_i, y_i)$. One of these sites is the unique highest peak $(x_p, y_p)$ such that 1ドル < p < N$ and $y_p > y_i$ for all $i \neq p$. Note that the highest peak cannot be the first or the last site. The entire mountain range is described by straight line segments connecting $(x_i, y_i)$ to $(x_{i+1}, y_{i+1})$ for 1ドル \leq i < N,ドル such that $x_i < x_{i+1}$.

입력

The first line of input contains the integer $N$ (3ドル \leq N \leq 5 \cdot 10^5$) which is the number of sites. The next $N$ lines each contains two integers $x_i$ and $y_i,ドル specifying the $N$ sites. The coordinates satisfy 0ドル \leq x_i, y_i \leq 10^9$. It is guaranteed that there is a unique highest peak, and that $x_i < x_{i+1}$ for all 1ドル \leq i < N$.

출력

On the first line, output the coordinates of the best site to the left of the highest peak. On the second line, output the coordinates of the best site to the right of the highest peak.

제한

예제 입력 1

5
10 10
20 20
30 40
40 30
50 0

예제 출력 1

10 10
40 30

예제 입력 2

5
10 10
20 20
30 30
40 20
50 10

예제 출력 2

10 10
50 10

예제 입력 3

10
10 10
20 35
30 20
40 40
50 45
60 40
70 30
80 40
90 20
1000 10

예제 출력 3

20 35
1000 10

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2024 Rocky Mountain Regional Contest J번

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

출처

대학교 대회

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

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