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

33604번 - Statues 스페셜 저지다국어

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

문제

The mayor of a city wants to place $n$ statues at intersections around the city. The intersections in the city are at all points $(x, y)$ with integer coordinates. Distances between intersections are measured using Manhattan distance, defined as follows:

$\text{distance}((x_1, y_1),(x_2, y_2)) = |x_1 - x_2| + |y_1 - y_2|$.

The city council has provided the following requirements for the placement of the statues:

  • The first statue is placed at $(0, 0)$;
  • The $n$-th statue is placed at $(a, b)$;
  • For $i = 1, \dots , n - 1,ドル the distance between the $i$-th statue and the $(i + 1)$-th statue is $d_i$.

It is allowed to place multiple statues at the same intersection.

Help the mayor find a valid arrangement of the $n$ statues, or determine that it does not exist.

입력

The first line contains an integer $n$ (3ドル ≤ n ≤ 50$) — the number of statues.

The second line contains two integers $a$ and $b$ (0ドル ≤ a, b ≤ 10^9$) — the coordinates of the intersection where the $n$-th statue must be placed.

The third line contains $n - 1$ integers $d_1, \dots , d_{n-1}$ (0ドル ≤ d_i ≤ 10^9$) — the distance between the $i$-th statue and the $(i + 1)$-th statue.

출력

Print YES if there is a valid arrangement of the $n$ statues. Otherwise, print NO.

If there is a valid arrangement, print a valid arrangement in the following $n$ lines. The $i$-th of these lines must contain two integers $x_i$ and $y_i$ — the coordinates of the intersection where the $i$-th statue is placed. You can print any valid arrangement if multiple exist.

제한

예제 입력 1

3
5 8
9 0

예제 출력 1

NO

There is no valid arrangement of the 3ドル$ statues.

예제 입력 2

4
10 6
7 8 5

예제 출력 2

YES
0 0
6 -1
11 2
10 6

The sample output is shown in the following picture. Note that this is not the only valid arrangement of the 4ドル$ statues.

힌트

출처

ICPC > Regionals > Europe > European Championship > The 2025 ICPC European Championship H번

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

출처

대학교 대회

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

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