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

30482번 - GPS on a Flat Earth 다국어

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

문제

On the day when aliens finally attacked humanity, nobody could have anticipated their weapon of choice. No nuclear weapons, meteors, lasers, or giant monsters. Instead, our planet was subjugated with the power of physics!

Specifically, the aliens transformed Earth into a two-dimensional, flat surface, forever neutering our space-faring capabilities. Although frustrated, humanity survived, and we resumed our lives as best as we could. This new two-dimensional existence requires many adjustments, including the use of GPS (Global Positioning System).

GPS normally works by using radio waves to measure the Euclidean distances from the user to several reference points (satellites), and using these distances to calculate the user’s coordinates. However, the now flat Earth has two quirks we need to adapt to:

  • Without satellites in orbit, we need to use radio towers instead. Each radio tower now has coverage over the entire planet due to the flat surface.
  • Radio waves, which propagate differently in a two-dimensional world, require a shift from Euclidean to Manhattan distance for accurate calculations. Given any two points (X1, Y1) and (X2, Y2), the Manhattan distance between them is defined as |X1 − X2| + |Y1 − Y2|.

Your task is to write software for these adapted GPS calculations. Given a list of locations of N reference radio towers and their respective Manhattan distances to the GPS user, your algorithm must provide a list of possible locations of the user. These potential user locations are limited to those that are exactly at the measured Manhattan distance from each reference radio tower. The GPS is still in the initial test phase, so the user’s true location is limited to integer coordinates.

입력

The first line contains an integer N (1 ≤ N ≤ 105) indicating the number of reference radio towers.

Each of the next N lines describes a tower with three integers X, Y (−104 ≤ X, Y ≤ 104), and D (0 ≤ D ≤ 4 × 104), representing that a tower with coordinates (X, Y) is at Manhattan distance D from the GPS user. No two towers have the same location. It is guaranteed that the input data is reliable, pinpointing a non-empty finite set of possible locations for a user with integer coordinates.

출력

Output several lines. Each line must contain a different pair of integers Xu and Yu indicating that (Xu, Yu) is a user location compatible with the input data. The lines must be sorted by non-decreasing Xu value, breaking ties by increasing Yu value.

제한

예제 입력 1

2
1 1 5
7 0 4

예제 출력 1

4 -1
5 2

예제 입력 2

2
1 1 5
5 5 3

예제 출력 2

2 5
3 4
4 3
5 2

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2023 G번

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

출처

대학교 대회

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

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